Decathlon / vitamin-ios

Decathlon Design System UI components for iOS & iPadOS applications
https://www.decathlon.design
Apache License 2.0
46 stars 14 forks source link

feat: Support LocalizedStringKey with TextField #130

Open GerardPaligot opened 1 year ago

GerardPaligot commented 1 year ago

Is your request related to a problem? Please describe.

Describe the solution you'd like

For now, when I would like to use vitaminTextFieldStyle or directly the Vitamin component, I can only pass a String for the label and helperText.

    public func vitaminTextFieldStyle(
        style: VitaminTextFieldStyle = .outlined,
        label: String,
        helperText: String? = nil,
        state: Binding<VitaminTextFieldState>,
        icon: VitaminTextField.IconConfiguration? = nil,
        characterLimit: VitaminTextField.CharacterLimitConfiguration? = nil
    )

We should add variant to support LocalizedStringKey in addition to the existing API.

    public func vitaminTextFieldStyle(
        style: VitaminTextFieldStyle = .outlined,
        label: LocalizedStringKey,
        helperText: LocalizedStringKey? = nil,
        state: Binding<VitaminTextFieldState>,
        icon: VitaminTextField.IconConfiguration? = nil,
        characterLimit: VitaminTextField.CharacterLimitConfiguration? = nil
    )