Skip to content

Commit

Permalink
fix: fix showFontPreview definition issue
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyingtao committed Oct 18, 2024
1 parent 5aa98ab commit ed5520e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/SwiftUIFontSettingsView/FontSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import SwiftUI

public struct FontSettings: Equatable {
public var showFontPreview = true
public var foregroundColor = Color.black
public var backgroundColor = Color.clear
public var textStyle = Font.TextStyle.title
Expand Down Expand Up @@ -78,6 +77,7 @@ public struct FontSettingsText {
public struct FontSettingsView<ExtraTopContent: View, ExtraBottomContent: View>: View {
@Binding var fontSettings: FontSettings

private let showFontPreview: Bool
private let fontSettingsText: FontSettingsText
private let showExtraTopContent: Bool
private let extraTopContent: ExtraTopContent?
Expand Down Expand Up @@ -166,13 +166,15 @@ public struct FontSettingsView<ExtraTopContent: View, ExtraBottomContent: View>:
public init(fontSettings: Binding<FontSettings>,
fontSettingsText: FontSettingsText = FontSettingsText(),
backgroundColor: Color? = nil,
showFontPreview: Bool = true,
showExtraTopContent: Bool = false,
@ViewBuilder topContentBuilder: () -> ExtraTopContent = (EmptyView.init),
showExtraBottomContent: Bool = false,
@ViewBuilder bottomContentBuilder: () -> ExtraBottomContent = (EmptyView.init)) {
self._fontSettings = fontSettings
self.fontSettingsText = fontSettingsText
self.backgroundColor = backgroundColor
self.showFontPreview = showFontPreview
self.showExtraTopContent = showExtraTopContent
self.extraTopContent = topContentBuilder()
self.showExtraBottomContent = showExtraBottomContent
Expand All @@ -193,7 +195,7 @@ public struct FontSettingsView<ExtraTopContent: View, ExtraBottomContent: View>:

if showFontPreview {
previewFontSection
}
}

colorSettingsSection

Expand Down

0 comments on commit ed5520e

Please sign in to comment.