Skip to content

Instantly share code, notes, and snippets.

@blsage
Created October 20, 2020 17:48
Show Gist options
  • Save blsage/8f0737795d4ac58e95e78eb076696001 to your computer and use it in GitHub Desktop.
Save blsage/8f0737795d4ac58e95e78eb076696001 to your computer and use it in GitHub Desktop.
Quickly implement a text field with all the UIKit capabilities 💪 in SwiftUI. 😲
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)
}
}
@blsage
Copy link
Author

blsage commented Oct 20, 2020

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 👉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment