Last active
March 13, 2019 04:12
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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