Skip to content

Protocol

Validatable

Capable of being validated. Conformance adds a throwing validate() method.
protocol Validatable

Overview

struct User: Validatable {
    var name: String
    var age: Int

    static func validations() -> [Validation] {
        [Validation(key: "name", validator: .count(5...) && .alphanumeric)]
    }
}

Topics

Type Methods