Skip to content

Instantly share code, notes, and snippets.

@marinofelipe
Last active March 13, 2019 04:12
Show Gist options
  • Save marinofelipe/18d2b515e07ad5cc349b9e9ea8aa2b6f to your computer and use it in GitHub Desktop.
Save marinofelipe/18d2b515e07ad5cc349b9e9ea8aa2b6f to your computer and use it in GitHub Desktop.
Blog post / Dynamic Type - Custom font protocol extended for enums that has RawValue of type String
protocol CustomFont {
func sized(_ size: CGFloat) -> UIFont?
}
extension CustomFont where Self: RawRepresentable, Self.RawValue == String {
func sized(_ size: CGFloat) -> UIFont? {
return UIFont(name: self.rawValue, size: size)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment