Created
October 20, 2020 17:48
-
-
Save blsage/8f0737795d4ac58e95e78eb076696001 to your computer and use it in GitHub Desktop.
Quickly implement a text field with all the UIKit capabilities 💪 in SwiftUI. 😲
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 | |
import iTextField | |
struct ContentView: View { | |
@State var text: String = "" | |
@State var isEditing: Bool = false | |
var body: some View { | |
iTextField("Placeholder", | |
text: $text, | |
isEditing: $isEditing) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Text field in SwiftUI
Featuring 1) calling closures when the text is edited, 2) a binding to isEditing that you control 3) secure entry built in, and more.
iTextField has three required parameters: 1️⃣ a placeholder, 2️⃣ a text state, and 3️⃣ an isEditing state. iTextField also supports a variety of modifiers.
See more here 👉