Last active
February 28, 2020 08:48
-
-
Save krzyzanowskim/e810f3163f529699277bb853930dc054 to your computer and use it in GitHub Desktop.
This file contains 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
@discardableResult | |
public func with<T>(_ value: T, _ builder: (T) -> Void) -> T { | |
builder(value) | |
return value | |
} | |
@discardableResult | |
public func with<T>(_ value: T, _ builder: (T) throws -> Void ) rethrows -> T { | |
try builder(value) | |
return value | |
} | |
// Use | |
with(self.collectionView) { | |
$0.dataSource = self | |
$0.delegate = self | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment