Skip to content

Commit

Permalink
Make sure text field updates when text changes externally.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeredpath committed Mar 16, 2021
1 parent bdff576 commit d9e984d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Demo Project/ResponsiveTextFieldDemo/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ struct ContentView: View {
Toggle("Enabled?", isOn: $isEnabled)
.padding(.bottom)

Button("Random password") {
password = UUID().uuidString
}

Text("You typed the following email:")
.padding(.bottom)

Expand Down
1 change: 1 addition & 0 deletions Sources/ResponsiveTextField/ResponsiveTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ extension ResponsiveTextField: UIViewRepresentable {
uiView.isSecureTextEntry = isSecure
uiView.returnKeyType = returnKeyType
uiView.font = font
uiView.text = text.wrappedValue

switch (uiView.isFirstResponder, firstResponderDemand?.wrappedValue) {
case (true, .shouldResignFirstResponder):
Expand Down

0 comments on commit d9e984d

Please sign in to comment.