Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created March 4, 2020 14:34
Show Gist options
  • Save azamsharp/3fdf5b80545247a844ff28824f10ec75 to your computer and use it in GitHub Desktop.
Save azamsharp/3fdf5b80545247a844ff28824f10ec75 to your computer and use it in GitHub Desktop.
import Foundation
import ValidatedPropertyKit
extension Validation where Value == String {
static var required: Validation {
return .init { value in
value.isEmpty ? .failure("\(value) cannot be empty") : .success(())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment