ValidatorKit

1.2.1

ValidatorKit is a straightforward validation library for Swift, designed to simplify data validation rules in iOS applications. It provides an easy way to ensure user input meets your specified criteria.
Alhiane/ValidatorKit

What's New

v1.2.1

2026-09-11T15:22:04Z

ValidatorKit 1.2.1

🐛 Bug Fixes

Full Changelog: v1.2.0...v1.2.1

ValidatorKit

A lightweight, fluent validation library for Swift — chainable rules, localized error messages, zero dependencies.

CI Swift 6.0 SPM compatible Platforms License: MIT

📖 Full documentation & rules reference

Why ValidatorKit

  • Fluent, chainable schemas — describe every field's rules in one readable expression
  • Zero dependencies — pure Swift, Foundation only
  • Localized out of the box — error messages ship in English, Arabic, Spanish, and French
  • 20+ built-in rules — email, phone, credit card (Luhn), IBAN, password strength, dates, regex, file size, and more
  • Works anywhere — validate a decoded JSON payload, a form dictionary, or a view model's fields the same way

Installation

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/Alhiane/ValidatorKit.git", from: "1.0.0-beta")
]

Quick start

import ValidatorKit

let schema = ValidationSchema()
    .field("email").required().email()
    .field("password").required().passwordStrength(minLength: 8, requireDigit: true, requireSymbol: true)
    .field("age").required().greaterThan(18)
    .ready()

let result = schema.validate([
    "email": "not-an-email",
    "password": "short",
    "age": 16
])

result.isValid            // false
result.errors["email"]    // ["Please enter a valid email address."]

Custom validation when a built-in rule isn't enough:

.field("username").required().custom(message: "Must be lowercase, no spaces") { value in
    guard let username = value as? String else { return false }
    return username == username.lowercased() && !username.contains(" ")
}

For the complete list of rules, localization details, and more examples, see the full docs.

Contributing

Issues and PRs are welcome — see CONTRIBUTING.md for the development and release workflow.

License

MIT — see LICENSE.

Description

  • Swift Tools 6.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Sep 26 2026 04:56:10 GMT-0900 (Hawaii-Aleutian Daylight Time)