Created
September 26, 2020 13:09
-
-
Save perpeer/82b6873f400044d9622a29b6f7f7eff3 to your computer and use it in GitHub Desktop.
SwiftUI Font Extension
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
| import SwiftUI | |
| enum YanoneKaffeesatz: String { | |
| case bold = "YanoneKaffeesatz-Bold" | |
| case extraLight = "YanoneKaffeesatz-ExtraLight" | |
| case light = "YanoneKaffeesatz-Light" | |
| case medium = "YanoneKaffeesatz-Medium" | |
| case regular = "YanoneKaffeesatz-Regular" | |
| case semiBold = "YanoneKaffeesatz-SemiBold" | |
| } | |
| extension View { | |
| func bold(size: CGFloat) -> some View { | |
| self.font(.custom(YanoneKaffeesatz.bold.rawValue, size: size)) | |
| } | |
| func extraLight(size: CGFloat) -> some View { | |
| self.font(.custom(YanoneKaffeesatz.extraLight.rawValue, size: size)) | |
| } | |
| func light(size: CGFloat) -> some View { | |
| self.font(.custom(YanoneKaffeesatz.light.rawValue, size: size)) | |
| } | |
| func medium(size: CGFloat) -> some View { | |
| self.font(.custom(YanoneKaffeesatz.medium.rawValue, size: size)) | |
| } | |
| func regular(size: CGFloat) -> some View { | |
| self.font(.custom(YanoneKaffeesatz.regular.rawValue, size: size)) | |
| } | |
| func semiBold(size: CGFloat) -> some View { | |
| self.font(.custom(YanoneKaffeesatz.semiBold.rawValue, size: size)) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment