Skip to content

Instantly share code, notes, and snippets.

@blsage
blsage / iPhoneNumberField.swift
Last active November 6, 2020 22:40
FORMAT PHONE NUMBERS IN SWIFTUI
import SwiftUI
import iPhoneNumberField
struct ContentView: View {
@State var text = ""
var body: some View {
iPhoneNumberField("Phone", text: $text)
}
}
@blsage
blsage / iPhoneNumberField-Demo5.swift
Created November 3, 2020 21:12
Custom style for phone number field
import SwiftUI
import iPhoneNumberField
struct ContentView: View {
@State var text: String = ""
@State var isEditing: Bool = false
var body: some View {
iPhoneNumberField("(000) 000-0000", text: $text, isEditing: $isEditing)
.flagHidden(false)
.flagSelectable(true)
@blsage
blsage / iPhoneNumberField-Demo4.swift
Created November 3, 2020 21:08
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 {
@blsage
blsage / iPhoneNumberField-Demo3.swift
Last active November 3, 2020 21:04
iPhoneNumberField flags
import SwiftUI
import iPhoneNumberField
struct ContentView: View {
@State var text = ""
var body: some View {
iPhoneNumberField(text: $text)
.flagHidden(false)
.flagSelectable(true)
}
@blsage
blsage / iPhoneNumberField-Demo2.swift
Created November 3, 2020 20:47
iPhoneNumberField getting started
import SwiftUI
import iPhoneNumberField
struct ContentView: View {
@State var text = ""
var body: some View {
iPhoneNumberField("Phone", text: $text)
}
}
@blsage
blsage / iPhoneNumberField-Demo1.swift
Created November 3, 2020 20:28
Formatting phone numbers is as easy as
iPhoneNumberField("Phone", text: $text)
@blsage
blsage / iDummyCursor-Main.swift
Created October 20, 2020 17:53
A dummy cursor view that looks and blinks like a real iOS 📱 cursor 🖱👆.
import SwiftUI
import iDummyCursor
struct ContentView: View {
var body: some View {
iDummyCursor()
}
}
@blsage
blsage / iPaymentButton-Main.swift
Created October 20, 2020 17:50
Quickly implement & easily customize the Apple Pay button. 💵
import SwiftUI
import iPaymentButton
struct ContentView: View {
var body: some View {
iPaymentButton(action: {
// Add your custom payment code here
})
}
}
@blsage
blsage / iTextField.swift-Main.swift
Created October 20, 2020 17:48
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,
@blsage
blsage / iPhoneNumberTextField-Main.swift
Created October 20, 2020 17:45
Quickly implement a text field designed for phone numbers. 📱🔢
import SwiftUI
import iPhoneNumberTextField
struct ContentView: View {
@State var text: String = ""
@State var isEditing: Bool = false
var body: some View {
iPhoneNumberTextField("Placeholder",
text: $text,