Skip to content

Commit d9e984d

Browse files
committed
Make sure text field updates when text changes externally.
1 parent bdff576 commit d9e984d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Demo Project/ResponsiveTextFieldDemo/ContentView.swift

+4
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ struct ContentView: View {
124124
Toggle("Enabled?", isOn: $isEnabled)
125125
.padding(.bottom)
126126

127+
Button("Random password") {
128+
password = UUID().uuidString
129+
}
130+
127131
Text("You typed the following email:")
128132
.padding(.bottom)
129133

Sources/ResponsiveTextField/ResponsiveTextField.swift

+1
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ extension ResponsiveTextField: UIViewRepresentable {
271271
uiView.isSecureTextEntry = isSecure
272272
uiView.returnKeyType = returnKeyType
273273
uiView.font = font
274+
uiView.text = text.wrappedValue
274275

275276
switch (uiView.isFirstResponder, firstResponderDemand?.wrappedValue) {
276277
case (true, .shouldResignFirstResponder):

0 commit comments

Comments
 (0)