Last active
October 12, 2015 15:56
-
-
Save chuganzy/649abb7aa6cea5af6d00 to your computer and use it in GitHub Desktop.
This file contains 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
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