Skip to content

Instantly share code, notes, and snippets.

@irace
Created December 2, 2015 04:30
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 irace/2ddf989624c80874844c to your computer and use it in GitHub Desktop.
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?
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