Releases: GSM-MSG/Configure
Releases · GSM-MSG/Configure
Configure 1.0.1
Configure 1.0
Configure
Extended methods for fluent syntax in Swift
Usage
set(_:_:)
Sets the value of a property using a key path.
let label = UILabel()
.set(\.text, "Hello, world!")
.set(\.textColor, .red)
then(_:)
Executes a closure with the object as its argument.
let label = UILabel().then {
$0.text = "Hello, world!"
$0.textColor = .red
}
mutate(_:)
Mutates the object with the given closure.
view.frame.mutate {
$0.origin.x = 100
$0.size.width = 150
}
let(_:)
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)
}
do(_:)
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")
}
Full Changelog: https://github.com/GSM-MSG/Configure/commits/1.0.0