diff --git a/Sources/SDS/Component/Button/SopoBottomButton.swift b/Sources/SDS/Component/Button/SopoBottomButton.swift index 5addb4b..69e9b8e 100644 --- a/Sources/SDS/Component/Button/SopoBottomButton.swift +++ b/Sources/SDS/Component/Button/SopoBottomButton.swift @@ -3,14 +3,20 @@ import SwiftUI public struct SopoBottomButton: View { let text: Text let background: Color + let action: (() -> ())? - public init(_ text: () -> Text, background: Color = .primary(.normal)) { + public init(_ text: () -> Text, background: Color = .primary(.normal), action: (() -> ())?) { self.text = text() self.background = background + self.action = action } public var body: some View { - Button {} label: { + Button { + if let action = action { + action() + } + } label: { RoundedRectangle(cornerRadius: 12) .frame(height: 56) .padding(.horizontal, 36) diff --git a/Sources/SDS/Component/TextField/SopoTextField.swift b/Sources/SDS/Component/TextField/SopoTextField.swift index 58416bb..440ef39 100644 --- a/Sources/SDS/Component/TextField/SopoTextField.swift +++ b/Sources/SDS/Component/TextField/SopoTextField.swift @@ -1,26 +1,24 @@ import SwiftUI + public struct SopoTextField: View { @Binding var text: String let prompt: String let isSecure: Bool - let inputType: NSTextContentType? let trailing: AnyView? - public init(text: Binding, prompt: String, isSecure: Bool = false, inputType: NSTextContentType? = .none, trailing: @escaping () -> some View) { + public init(text: Binding, prompt: String, isSecure: Bool = false, trailing: @escaping () -> some View) { self._text = text self.prompt = prompt self.isSecure = isSecure - self.inputType = inputType self.trailing = AnyView(trailing()) } - public init(text: Binding, prompt: String, isSecure: Bool = false, inputType: NSTextContentType? = .none) { + public init(text: Binding, prompt: String, isSecure: Bool = false) { self._text = text self.prompt = prompt self.isSecure = isSecure - self.inputType = inputType self.trailing = nil } @@ -40,7 +38,7 @@ public struct SopoTextField: View { prompt: Text(prompt) .foregroundColor(.label(.disable)) ) - + .textContentType(.password) } else { TextField( @@ -52,10 +50,9 @@ public struct SopoTextField: View { } } .autocorrectionDisabled() - .textContentType(inputType) - #if os(iOS) +#if os(iOS) .textInputAutocapitalization(.never) - #endif +#endif .font(.label(.bold)) .foregroundStyle(Color.label(.normal))