Skip to content

Instantly share code, notes, and snippets.

@malcolmkmd
Created July 10, 2017 11:23
Show Gist options
  • Save malcolmkmd/7a8ddb04d352fbd6a9bfc74dbb97c4f0 to your computer and use it in GitHub Desktop.
Save malcolmkmd/7a8ddb04d352fbd6a9bfc74dbb97c4f0 to your computer and use it in GitHub Desktop.
String Extensions
import UIKit
import BonMot
extension String {
func styleTitle() -> NSAttributedString {
let style = StringStyle(
.font(UIFont(name: "Futura", size: 18)!),
.color(UIColor.white)
)
let attributedString = self.styled(with: style)
return attributedString
}
func styleHeading() -> NSAttributedString {
let style = StringStyle(
.font(UIFont(name: "Avenir-Black", size: 20)!),
.color(UIColor.red)
)
let attributedString = self.styled(with: style)
return attributedString
}
func stylePrice() -> NSAttributedString {
let style = StringStyle(
.font(UIFont(name: "Avenir-Black", size: 24)!),
.color(UIColor.lightGray)
)
let attributedString = self.styled(with: style)
return attributedString
}
func styleBody() -> NSAttributedString {
let style = StringStyle(
.font(UIFont(name: "Avenir", size: 14)!),
.color(UIColor.flatBlack)
)
let attributedString = self.styled(with: style)
return attributedString
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment