Created
December 2, 2015 04:30
-
-
Save irace/2ddf989624c80874844c to your computer and use it in GitHub Desktop.
Possible to write a function that can return any Instance conforming to Validator where ValidatedType == String?
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
protocol Validator { | |
typealias ValidatedType | |
func isValid(object: ValidatedType) -> Bool | |
} | |
struct NonEmptyValidator: Validator { | |
func isValid(object: String) -> Bool { | |
return object.isEmpty | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment