Skip to content

Commit

Permalink
add demo for extending niceTextStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanlensink committed Jan 30, 2024
1 parent 24916b4 commit b0f6e8d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions NiceComponentsExample/NiceComponentsExample/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ struct ContentView_Previews: PreviewProvider {
ContentView()
}
}


extension NiceTextStyle {
static var customBodyText = NiceTextStyle(
fontTheme: FontTheme("Impact", size: 16),
textTheme: TextTheme(color: .green)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ struct AllComponentsView: View {
VStack(alignment: .leading, spacing: 2) {
NiceText("Body Text", style: .body)

NiceText("Body Text", style: .customBodyText)

Text("Body Text")
.niceText(.body)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public struct SampleSignInView: View {
@State private var emailField: String = ""
@State private var passwordField: String = ""

// TODO: Can I do the thing with view modifiers? Is that weirder?
public var body: some View {
VStack(alignment: .leading, spacing: NiceSpacing.standard) {
NiceText("Sign In", style: .screenTitle)
Expand Down

0 comments on commit b0f6e8d

Please sign in to comment.