-
-
Save sturdysturge/6b3c2bce47270810afc357a931bd1224 to your computer and use it in GitHub Desktop.
RevDoc TextContextType
This file contains hidden or 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 | |
struct TextContentTypeView: View { | |
#if os(macOS) | |
let contentTypes: [NSTextContentType] = [.username, .password, .oneTimeCode] | |
#else | |
let contentTypes: [UITextContentType] = [.URL, .addressCity, .addressCityAndState, .addressState, .countryName, .creditCardNumber, .emailAddress, .familyName, .fullStreetAddress, .givenName, .jobTitle, .location, .middleName, .name, .namePrefix, .nameSuffix, .newPassword, .nickname, .oneTimeCode, .organizationName, .password, .postalCode, .streetAddressLine1, .streetAddressLine2, .sublocality, .telephoneNumber, .username] | |
#endif | |
@State var text = "" | |
var body: some View { | |
Form { | |
ForEach(contentTypes, id: \.self) { | |
contextType in | |
TextField("Enter text for \(contextType.rawValue)", text: $text) | |
.textContentType(contextType) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment