Created
November 3, 2020 21:12
-
-
Save blsage/3273a9682ea4a99988744b652082252b to your computer and use it in GitHub Desktop.
Custom style for phone number field
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 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) | |
.font(UIFont(size: 30, weight: .light, design: .monospaced)) | |
.maximumDigits(10) | |
.foregroundColor(Color.pink) | |
.clearButtonMode(.whileEditing) | |
.onClear { _ in isEditing.toggle() } | |
.accentColor(Color.orange) | |
.padding() | |
.background(Color.white) | |
.cornerRadius(10) | |
.shadow(color: isEditing ? .lightGray : .white, radius: 10) | |
.padding() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment