Created
March 3, 2022 19:30
-
-
Save nh7a/037b2162b54016052a19df4bfbc1c726 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
public protocol WithConfigurable {} | |
public extension WithConfigurable where Self: AnyObject { | |
@discardableResult | |
func with(block: (Self) -> Void) -> Self { | |
block(self) | |
return self | |
} | |
} | |
extension NSObject: WithConfigurable {} | |
// let lbl = UILabel().with { | |
// $0.text = "yes" | |
// $0.textColor = .red | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment