Last active
September 22, 2021 22:06
-
-
Save elefantel/d57498f8eb98ab5b1606f70cf9ec1f21 to your computer and use it in GitHub Desktop.
A theming protocol for abstracting Luno fonts and colour themes
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 Theme { | |
static var isLunoV3Enabled: Bool { get } | |
} | |
/** | |
Theme type dynamically determined based on the `isLunoV3Enabled` flag | |
*/ | |
extension Theme { | |
static var color: ThemeColor.Type { | |
isLunoV3Enabled ? LunoThemeColor.self : LegacyThemeColor.self | |
} | |
static var font: ThemeFont.Type { | |
isLunoV3Enabled ? LunoThemeFont.self : LegacyThemeFont.self | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment