Easy font branding for your iOS app.
- Override the default system font with your own branded font.
- Compatible with both UIKit and SwiftUI.
- Simple and intuitive API for quick integration.
Instant font branding, automatically overriding system font:
UIFont.systemFontFamilyOverride = "Marker Felt" // replace with appropriate font
Explicitly specify font in UIKit:
someUIKitElement.font = .systemFontOverride(size: 16)
Explicitly specify font in SwiftUI:
someSwiftUIView
.font(.systemOverride(size: 16))
pod 'SystemFontOverride'
dependencies: [
.package(url: "https://github.com/yonat/SystemFontOverride", from: "1.0.0")
]
Most UI elements will just work with the override font.
However, a few elements completely ignore the override:
- Sheet presented by
ColorPicker
orUIColorWell
Additionally, some SwiftUI controls require explicit .font()
modifier to update their title font:
Picker
Menu
Toggle
bordered
andborderedProminent
button stylesLabel
in some contexts
See the Demo app for details.
To automatically override the system font, SystemFontOverride uses method swizzling for UIFont.systemFont(ofSize:)
and related methods.
Segmented controls and UITextField
ignore the system font override, but their appearance()
proxy correctly sets their titles to the override font.