Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
struct Contact {
var fullName: String
@EmailValidated var email: String?
}
var contact = Contact(fullName: "Toomas")
contact.email = "invalidemail"
print(contact.email as Any) // nil
contact.email = " test toomas@email.zz"
print(contact.email as Any) // nil
contact.email = "toomas@email.zz"
print(contact.email as Any) // Optional("toomas@email.zz")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment