File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Sources/SwiftCrossUI/Views Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,21 @@ public struct TextField: ElementaryView, View {
6
6
private var value : Binding < String > ?
7
7
8
8
/// Creates an editable text field with a given placeholder.
9
+ public init ( _ placeholder: String = " " , text: Binding < String > ) {
10
+ self . placeholder = placeholder
11
+ self . value = text
12
+ }
13
+
14
+ /// Creates an editable text field with a given placeholder.
15
+ @available (
16
+ * , deprecated,
17
+ message: " Use TextField(_:text:) instead " ,
18
+ renamed: " TextField.init(_:text:) "
19
+ )
9
20
public init ( _ placeholder: String = " " , _ value: Binding < String > ? = nil ) {
10
21
self . placeholder = placeholder
11
- self . value = value
22
+ var dummy = " "
23
+ self . value = value ?? Binding ( get: { dummy } , set: { dummy = $0 } )
12
24
}
13
25
14
26
public func asWidget< Backend: AppBackend > ( backend: Backend ) -> Backend . Widget {
You can’t perform that action at this time.
0 commit comments