Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created August 14, 2019 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/ab4bd0ae1a8006cf76ccff8eb2db2fa7 to your computer and use it in GitHub Desktop.
Save laevandus/ab4bd0ae1a8006cf76ccff8eb2db2fa7 to your computer and use it in GitHub Desktop.
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