Extended methods for fluent syntax in Swift
- Swift 5.0+
- iOS 11.0+
- tvOS 11.0+
- macOS 10.13+
- watchOS 4.0+
Extended methods for fluent syntax in Swift
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Swift Package Manager is a tool for managing the distribution of Swift code. Itâs integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
To integrate Configure into your Xcode project using Swift Package Manager, add it to the dependencies value of your Package.swift:
dependencies: [
.package(url: "https://github.com/GSM-MSG/Configure.git", .upToNextMajor(from: "1.0.0"))
]If you prefer not to use either of the aforementioned dependency managers, you can integrate MSGLayout into your project manually.
.setSets the value of the property identified by the given key path..thenExecutes the given closure with the object as its argument..mutateMutates the object with the given closure..letApplies the given closure to the object and returns the result..doExecutes the given closure with the object as its argument.
Sets the value of a property using a key path.
let label = UILabel()
.set(\.text, "Hello, world!")
.set(\.textColor, .red)Executes a closure with the object as its argument.
let label = UILabel().then {
$0.text = "Hello, world!"
$0.textColor = .red
}Mutates the object with the given closure.
view.frame.mutate {
$0.origin.x = 100
$0.size.width = 150
}Applies the given closure to the object and returns the result.
let dateString = Date().let {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd"
return formatter.string(from: $0)
}Executes the given closure with the object as its argument.
UserDefaults.standard.do {
$0.set(42, forKey: "number")
$0.set("hello", forKey: "string")
$0.set(true, forKey: "bool")
}