Created
July 5, 2023 23:19
-
-
Save rafaelcrz/f280f2992c5de2e5438daca6b181902d to your computer and use it in GitHub Desktop.
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
extension Font { | |
static func rounded(_ style: Font.TextStyle = .body, weight: Font.Weight = .semibold) -> Font { | |
return .system(size: style.size, weight: weight, design: .rounded) | |
} | |
} | |
extension Font.TextStyle { | |
var size: CGFloat { | |
switch self { | |
case .largeTitle: return 60 | |
case .title: return 48 | |
case .title2: return 34 | |
case .title3: return 24 | |
case .headline, .body: return 18 | |
case .subheadline, .callout: return 16 | |
case .footnote: return 14 | |
case .caption, .caption2: return 12 | |
@unknown default: | |
return 8 | |
} | |
} | |
} |
Author
rafaelcrz
commented
Jul 5, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment