Skip to content

Commit

Permalink
Round fonts in (SwiftUI) Settings screen when requested by theme
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanw committed Jun 19, 2024
1 parent 7f1cd4c commit 8253d6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions AwfulExtensions/Sources/SwiftUI/Backports.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
import SwiftUI

public extension Backport where Content: View {

@ViewBuilder func fontDesign(_ design: Font.Design?) -> some View {
if #available(iOS 16.1, *) {
content.fontDesign(design)
} else {
content
}
}

/// Sets the font weight of the text in this view.
@ViewBuilder func fontWeight(_ weight: Font.Weight?) -> some View {
if #available(iOS 16, *) {
Expand Down
1 change: 1 addition & 0 deletions AwfulSettingsUI/Sources/AwfulSettingsUI/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ public struct SettingsView: View {
}
.section()
}
.backport.fontDesign(theme.roundedFonts ? .rounded : nil)
.foregroundStyle(theme[color: "listText"]!)
.tint(theme[color: "tint"]!)
.backport.scrollContentBackground(.hidden)
Expand Down

0 comments on commit 8253d6f

Please sign in to comment.