Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@propertyWrapper
struct EmailValidated {
private var value: String?
var wrappedValue: String? {
get {
return value
}
set {
value = {
guard let trimmedString = newValue?.trimmingCharacters(in: .whitespacesAndNewlines) else { return nil }
return validate(trimmedString)
}()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment