Skip to content

Instantly share code, notes, and snippets.

@ConorBrady
Created April 26, 2017 13:47
Show Gist options
  • Save ConorBrady/fb46c7aa7e7d6b5e37e918c80eaede65 to your computer and use it in GitHub Desktop.
Save ConorBrady/fb46c7aa7e7d6b5e37e918c80eaede65 to your computer and use it in GitHub Desktop.
public extension UILabel {
func styleText(font: UIFont, color: UIColor, alignment: NSTextAlignment = .left) -> UILabel {
return self <== {
$0.font = font
$0.textColor = color
$0.textAlignment = alignment
}
}
func wrapLines(max: Int = 0) -> UILabel {
return self <== {
$0.numberOfLines = max
$0.lineBreakMode = .byWordWrapping
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment