Skip to content

Instantly share code, notes, and snippets.

@MoathOthman
Created January 13, 2019 12:00
Show Gist options
  • Save MoathOthman/83202d8e3bf54751e4bb1bf0f1427c86 to your computer and use it in GitHub Desktop.
Save MoathOthman/83202d8e3bf54751e4bb1bf0f1427c86 to your computer and use it in GitHub Desktop.
for the lazy people
let view = UIView().with {$0.backgroundColor = .red}.with({$0.alpha = 0.3})
extension UIView {
func with(_ process: (UIView) -> ()) -> UIView {
process(self)
return self
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment