Skip to content

Instantly share code, notes, and snippets.

@blsage
Created November 3, 2020 21:08
Show Gist options
  • Save blsage/f619dfea51f34bd4ee9a42e924354cc5 to your computer and use it in GitHub Desktop.
Save blsage/f619dfea51f34bd4ee9a42e924354cc5 to your computer and use it in GitHub Desktop.
Jump text fields (focus and unfocus)
import SwiftUI
import iTextField
import iPhoneNumberField
struct ContentView: View {
@State var nameText = ""
@State var phoneText = ""
@State var phoneEditing = false
var body: some View {
VStack {
iTextField("Name", text: $nameText)
.font(UIFont(size: 24, weight: .light, design: .monospaced))
.padding()
.onReturn { phoneEditing = true }
iPhoneNumberField("Phone", text: $phoneText, isEditing: $phoneEditing)
.font(UIFont(size: 24, weight: .light, design: .monospaced))
.padding()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment