-
Notifications
You must be signed in to change notification settings - Fork 0
ThemeModifier
ppraveentr edited this page Apr 2, 2023
·
3 revisions
A modifier that you apply to a view or another view modifier, producing a different version of the original value.
public struct ThemeModifier: ViewModifier
The example below combines several modifiers to create a new modifier that you can use to create blue text in 'title' font:
struct ContentView: View {
var body: some View {
Text("Downtown Bus")
.font(.title)
.foregroundColor(Color.blue)
}
}
Instead, you can then apply the theme style to any view, similar to this:
Text("Downtown Bus")
.style("styleName")
This shows the Text View: "Downtown Bus", using custom a modifier, renders the text in blue text with "Title" font.
ViewModifier
public func body(content: Content) -> some View
Generated at 2023-04-02T01:45:21+0000 using swift-doc 1.0.0-rc.1.