diff --git a/DesignToolbox/DesignToolbox/Pages/Components/Switch/SwitchConfiguration.swift b/DesignToolbox/DesignToolbox/Pages/Components/Switch/SwitchConfiguration.swift index 6fde42717..5c4931c71 100644 --- a/DesignToolbox/DesignToolbox/Pages/Components/Switch/SwitchConfiguration.swift +++ b/DesignToolbox/DesignToolbox/Pages/Components/Switch/SwitchConfiguration.swift @@ -42,7 +42,7 @@ final class SwitchConfigurationModel: ComponentConfiguration { @Published var orientation: OUDSSwitch.Orientation { didSet { updateCode() } } - @Published var labelContent: String + @Published var labelTextContent: String @Published var helperTextContent: String // MARK: Initializer @@ -55,7 +55,7 @@ final class SwitchConfigurationModel: ComponentConfiguration { onError = false divider = true orientation = .default - labelContent = String(localized: "app_components_switch_label_text") + labelTextContent = String(localized: "app_components_switch_labelText_text") helperTextContent = String(localized: "app_components_switch_helperText_text") } @@ -85,7 +85,7 @@ final class SwitchConfigurationModel: ComponentConfiguration { private var helperTextPatern: String { if helperText { - return ",helperText: \(String(localized: "app_components_switch_helperText_text"))" + return ", helperText: \(String(localized: "app_components_switch_helperText_text"))" } else { return "" } @@ -163,7 +163,7 @@ struct SwitchConfiguration: View { } DisclosureGroup("app_components_common_editContent_label") { - DesignToolboxTextField(text: $model.labelContent, prompt: "app_components_common_userText_prompt", title: "app_components_switch_label_text") + DesignToolboxTextField(text: $model.labelTextContent, prompt: "app_components_common_userText_prompt", title: "app_components_switch_labelText_label") if model.helperText { DesignToolboxTextField(text: $model.helperTextContent, prompt: "app_components_common_userText_prompt", title: "app_components_common_helperText_label") } diff --git a/DesignToolbox/DesignToolbox/Pages/Components/Switch/SwitchPage.swift b/DesignToolbox/DesignToolbox/Pages/Components/Switch/SwitchPage.swift index ee055934e..f6d33a29b 100644 --- a/DesignToolbox/DesignToolbox/Pages/Components/Switch/SwitchPage.swift +++ b/DesignToolbox/DesignToolbox/Pages/Components/Switch/SwitchPage.swift @@ -85,7 +85,7 @@ private struct SwitchDemo: View { } else { OUDSSwitch( isOn: $isOn, - label: model.labelContent, + labelText: model.labelTextContent, helperText: helperTextContent, icon: icon, onError: model.onError, diff --git a/DesignToolbox/DesignToolbox/Resources/en.lproj/Localizable.strings b/DesignToolbox/DesignToolbox/Resources/en.lproj/Localizable.strings index 0b6cc6153..2eb7a2c24 100644 --- a/DesignToolbox/DesignToolbox/Resources/en.lproj/Localizable.strings +++ b/DesignToolbox/DesignToolbox/Resources/en.lproj/Localizable.strings @@ -111,6 +111,7 @@ "app_components_common_style_label" = "Style"; "app_components_common_onColoredBackground_label" = "On colored background"; "app_components_common_helperText_label" = "Helper text"; +"app_components_common_labelText_label" = "Label text"; "app_components_common_icon_label" = "Icon"; "app_components_common_divider_label" = "Divider"; "app_components_common_onError_label" = "On error"; @@ -143,6 +144,6 @@ "app_components_switch_label" = "Switch"; "app_components_switch_description_text" = "A switch is a component that allows the user to toggle between two states, typically \"on\" and \"off\". It is often represented as a button or a slider that changes position or color to indicate the current state. Switches are used to enable or disable features, options, or settings in an intuitive and visual manner."; -"app_components_switch_label_text" = "Label"; "app_components_switch_switchOnly_label" = "Switch only"; +"app_components_switch_labelText_text" = "Label text"; "app_components_switch_helperText_text" = "Helper text"; diff --git a/OUDS/Core/Components/Sources/Switch/Internal/OUDSSwitchLabel.swift b/OUDS/Core/Components/Sources/Switch/Internal/OUDSSwitchLabel.swift index c0d651d65..4609d5ce2 100644 --- a/OUDS/Core/Components/Sources/Switch/Internal/OUDSSwitchLabel.swift +++ b/OUDS/Core/Components/Sources/Switch/Internal/OUDSSwitchLabel.swift @@ -23,7 +23,7 @@ struct OUDSSwitchLabel: View { @Environment(\.colorScheme) private var colorScheme struct Label { - let label: String + let labelText: String let helperText: String? let icon: Image? let onError: Bool @@ -68,7 +68,7 @@ struct OUDSSwitchLabel: View { @ViewBuilder private var texts: some View { VStack(alignment: .leading, spacing: 0) { - Text(LocalizedStringKey(label.label)) + Text(LocalizedStringKey(label.labelText)) .typeLabelDefaultLarge(theme) .multilineTextAlignment(.leading) .foregroundStyle(labelColor) diff --git a/OUDS/Core/Components/Sources/Switch/OUDSSwitch.swift b/OUDS/Core/Components/Sources/Switch/OUDSSwitch.swift index 7c402432b..24831512d 100644 --- a/OUDS/Core/Components/Sources/Switch/OUDSSwitch.swift +++ b/OUDS/Core/Components/Sources/Switch/OUDSSwitch.swift @@ -73,15 +73,15 @@ public struct OUDSSwitch: View { /// - Parameters: /// - isOn: A binding to a property that determines whether the switch is on /// or off. - /// - label: The main label of the switch. + /// - labelText: The main label text of the switch. /// - helperText: An additonal helper text. /// - icon: An optional icon /// - onError: It the option is on error /// - divider: If true a divider is added at the bottom of the view. /// - orientation: Specify the orientation of the layout. If Default the switch at the leading position, if inverse it is on trailing. - public init(isOn: Binding, label: String, helperText: String? = nil, icon: Image? = nil, onError: Bool = false, divider: Bool = false, orientation: Orientation = .default) { + public init(isOn: Binding, labelText: String, helperText: String? = nil, icon: Image? = nil, onError: Bool = false, divider: Bool = false, orientation: Orientation = .default) { self.isOn = isOn - self.layout = .labeled(.init(label: label, helperText: helperText, icon: icon, onError: onError, divider: divider, orientation: orientation)) + self.layout = .labeled(.init(labelText: labelText, helperText: helperText, icon: icon, onError: onError, divider: divider, orientation: orientation)) } // swiftlint:enable line_length