From 7a4584544beaff013e397fbab76d7cd62f596c91 Mon Sep 17 00:00:00 2001 From: Aakiyaru Date: Tue, 27 May 2025 20:17:15 +0700 Subject: [PATCH] fix --- Sources/UIKitComponents/Example/SelectTestView.swift | 2 +- Sources/UIKitComponents/Select/SelectView.swift | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Sources/UIKitComponents/Example/SelectTestView.swift b/Sources/UIKitComponents/Example/SelectTestView.swift index 3dbc7f7..4a9997c 100644 --- a/Sources/UIKitComponents/Example/SelectTestView.swift +++ b/Sources/UIKitComponents/Example/SelectTestView.swift @@ -15,7 +15,7 @@ struct SelectTestView: View { } var body: some View { - SelectView(title: "Пол", variants: variantds) + SelectView(title: "Пол", text: .constant(""), variants: variantds) } } diff --git a/Sources/UIKitComponents/Select/SelectView.swift b/Sources/UIKitComponents/Select/SelectView.swift index 1110f01..ce80d56 100644 --- a/Sources/UIKitComponents/Select/SelectView.swift +++ b/Sources/UIKitComponents/Select/SelectView.swift @@ -10,10 +10,12 @@ import SwiftUI public struct SelectView: View { @State var title: String + @Binding var text: String let variants: [String] - public init(title: String, variants: [String]) { + public init(title: String, text: Binding, variants: [String]) { self.title = title + self._text = text self.variants = variants } @@ -23,6 +25,7 @@ public struct SelectView: View { ForEach(variants, id: \.self) { variant in Button(variant) { title = variant + text = variant } } @@ -55,5 +58,5 @@ public struct SelectView: View { } #Preview { - SelectView(title: "Пол", variants: ["Male", "Female", "gay"]) + SelectView(title: "Пол", text: .constant(""), variants: ["Male", "Female", "gay"]) }