-
-
Save sturdysturge/120e81f5b6e1978b8e5ccc5b5e6dbb3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct FocusableTextField: View { | |
@Binding var text: String | |
@Binding var focusedBinding: Bool | |
@FocusState private var focused: Bool | |
var body: some View { | |
TextField("Text", text: $text) | |
.focused($focused) | |
.onChange(of: focusedBinding) { focusedBinding in | |
focused = focusedBinding | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment