SwiftUI / UIKit design tokens for the Polkadot App: colors, typography, spacings, radii. Generated from polkadot-app-design-system — do not edit files under Sources/DesignSystem/Generated/ by hand; they're regenerated on every release.
In Package.swift:
.package(
url: "https://github.com/novasamatech/polkadot-app-design-system-ios",
from: "0.0.1"
)…then add "DesignSystem" to your target's dependencies. Or use Xcode's File → Add Package Dependencies… with the same URL.
Tags are published as X.Y.Z (no v prefix). See the Releases page.
Sources/DesignSystem/
├── Theme/ Theme protocol + CommonTheme base
├── ThemeManager/ Singleton that resolves and persists the active theme
├── Typography/ TypographyFamily protocol + style composition (.emphasized, .mono)
├── TypographyManager/ Singleton that resolves and persists the active typography family
├── Tokens/ UIColor.app(_:), UIFont.app(_:) resolvers
├── Traits/ DSThemeTrait, DSTypographyTrait + UIView typography binding
├── SwiftUI/ .typography(_:) view modifier with reactive trait binding
├── Extensions/ UIColor(rgbHex:), UIColor(rgbaHex:)
└── Generated/ Style Dictionary output — do not hand-edit
├── colors/ ThemeColorsProtocol, UIColor+Tokens, Color+Tokens, per-theme classes
├── typography/ Typescale, font family/weight enums, UIFont+Tokens, per-family classes
├── radii/ DSRadii (zero, tiny, …, full)
└── spacings/ DSSpacings (zero, tiny, …, extraLargeIncreased)
In your scene delegate's scene(_:willConnectTo:options:):
import DesignSystem
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options: UIScene.ConnectionOptions) {
guard let windowScene = scene as? UIWindowScene else { return }
ThemeManager.shared.setup(scene: windowScene)
TypographyManager.shared.setup(scene: windowScene)
// your usual scene setup…
}setup(scene:) (a) captures the scene for future trait broadcasts, (b) applies the persisted theme/typography selection as a trait override before any view renders.
SwiftUI colors (reactive — driven by UIColor(dynamicProvider:)):
Text("Hello").foregroundStyle(.fgPrimary)SwiftUI typography (reactive — driven by environment-bridged trait):
Text("Hello").typography(.bodyMedium)UIKit colors (reactive — dynamic UIColor):
label.textColor = .fgPrimaryUIKit fonts (snapshot — UIFont can't be dynamic; bind explicitly if you need live updates):
label.font = .bodyMedium
label.bindAppTypography { $0.font = .bodyMedium }Radii and spacings (static values):
RoundedRectangle(cornerRadius: DSRadii.medium)
VStack(spacing: DSSpacings.large) { … }Tokens are edited in the upstream polkadot-app-design-system repo. The generator regenerates the Swift output into Sources/DesignSystem/Generated/ — those files are checked in here but driven by the upstream source.