Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
struct Person {
let name: String
func isValid() -> Bool {
return !name.characters.isEmpty
let validPerson = Person(name: "Tom")
let invalidPerson = Person(name: "")
validPerson.isValid() // => true
Person.isValid(validPerson)() // => true
invalidPerson.isValid() // => false
Person.isValid(invalidPerson)() // => false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.