.font() does accept Font.TextStyle (https://developer.apple.com/documentation/swiftui/font/textstyle).
I specify Font.TextStyle, because I have a Picker in the parent view that'll determine selectedSystemFont, and it does not register state change from the ForEach without it.
Picker(
selection: $selectedSystemStyle) {
ForEach(Font.TextStyle.allCases, id: \.self) { appleTextStyle in
Text(appleTextStyle.rawValue).tag(appleTextStyle)
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: