Skip to content

Instantly share code, notes, and snippets.

@irace
Created December 2, 2015 04:30
Show Gist options
  • Select an option

  • Save irace/2ddf989624c80874844c to your computer and use it in GitHub Desktop.

Select an option

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