Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save damodarnamala/0c3869e975363aebdf491e459ec39572 to your computer and use it in GitHub Desktop.
Save damodarnamala/0c3869e975363aebdf491e459ec39572 to your computer and use it in GitHub Desktop.
Writing the extensions like rx
// Extention
extension UILabel {
func color(_ color: UIColor)->UILabel {
self.textColor = color
return self
}
func font(_ name: String = "Helvetica ", size: CGFloat = 10)->UILabel {
self.font = UIFont(name: name, size: size)
return self
}
}
// Ussage
let label = UILabel()
label
.color(UIColor.red)
.font("Helvetica", size: 12)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment