Skip to content

Commit

Permalink
Fix title text attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
simonnickel committed Apr 29, 2024
1 parent 9b279d4 commit 2baf58f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Sources/SnapTheme/Theme/Theme+NavigationBarAppearance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@ extension Theme {
// TODO idea: Set font from theme. Needs to get UIFont from Font.
// Converting Font to UIFont is a bit tricky. This will at least use fontDesignDefault of the Theme.
// Only applied on app start.
let font = UIFont.preferredFont(for: Theme.FontDefinition.TextStyle.largeTitle.valueUIKit, weight: .bold, design: theme.fontDesignDefault.valueUIFontDescriptor)
let font = UIFont.preferredFont(for: Theme.FontDefinition.TextStyle.headline.valueUIKit, weight: .semibold, design: theme.fontDesignDefault.valueUIFontDescriptor)
let fontLarge = UIFont.preferredFont(for: Theme.FontDefinition.TextStyle.largeTitle.valueUIKit, weight: .bold, design: theme.fontDesignDefault.valueUIFontDescriptor)

let attributes: [NSAttributedString.Key : Any] = [
.foregroundColor: UIColor(color),
.font: font,
]
let attributesLarge: [NSAttributedString.Key : Any] = [
.foregroundColor: UIColor(color),
.font: fontLarge,
]
standardAppearance.titleTextAttributes = attributes
standardAppearance.largeTitleTextAttributes = attributes
standardAppearance.largeTitleTextAttributes = attributesLarge

UINavigationBar.appearance().standardAppearance = standardAppearance
}
Expand Down

0 comments on commit 2baf58f

Please sign in to comment.