Skip to content

Instantly share code, notes, and snippets.

@tonespy
Last active March 8, 2018 10:03
Show Gist options
  • Save tonespy/8baabe87ca260fc85a53511241c70ac1 to your computer and use it in GitHub Desktop.
Save tonespy/8baabe87ca260fc85a53511241c70ac1 to your computer and use it in GitHub Desktop.
MutableStrings
let aggreementLabel: UILabel = {
let label = UILabel()
label.font = UIFont.systemFont(ofSize: 15)
label.textColor = UIColor.textfieldTextColor()
label.numberOfLines = 0
let titles = ["I agree to the", " terms and conditions", " and confirm that the information I have provided is accurate."]
let colors = [UIColor.authTextGray(), UIColor.appColor(), UIColor.authTextGray()]
let attributedText = NSMutableAttributedString().generateMultipleColorString(sentences: titles, colors: colors)
if let attributedText = attributedText {
label.attributedText = attributedText
}
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()
let signupField: UIButton = {
let button = UIButton()
let titles = ["don't have an account?", " Sign up"]
let colors = [UIColor.authTextGray(), UIColor.appColor()]
let attributedText = NSMutableAttributedString().generateMultipleColorString(sentences: titles, colors: colors)
if let attributedText = attributedText {
button.setAttributedTitle(attributedText, for: .normal)
}
button.titleLabel?.font = UIFont.systemFont(ofSize: 15)
button.translatesAutoresizingMaskIntoConstraints = false
return button
}()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment