Last active
April 15, 2020 10:55
-
-
Save krummler/4fcad3881f527a82bc2a85cc2e453dd8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
extension UIFont { | |
func with(style: UIFont.TextStyle, basePointSize: CGFloat, maxPointSize: CGFloat? = nil) -> UIFont { | |
if let maxPointSize = maxPointSize { | |
return UIFontMetrics(forTextStyle: style).scaledFont(for: self.withSize(basePointSize), | |
maximumPointSize: maxPointSize) | |
} | |
return UIFontMetrics(forTextStyle: style).scaledFont(for: self.withSize(basePointSize)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment