Created
June 21, 2024 14:02
-
-
Save erenkabakci/b1180a024052f0fb3851fb0a2b6b80ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precedencegroup FunctionBuilderUtility { | |
associativity: none | |
} | |
infix operator .. : FunctionBuilderUtility | |
@discardableResult | |
public func .. <T>(object: T, block: (inout T) -> Void) -> T { | |
var object = object | |
block(&object) | |
return object | |
} | |
```swift | |
Build variables using a @FunctionBuilder like syntactic sugar. | |
private let someElement = SomeElement()..{ | |
$0.font = .body() | |
$0.textColor = .secondaryWhite | |
$0.textAlignment = .center | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment