Giter Site home page Giter Site logo

juancolilla / validationkit Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3 KB

A set of Validators for Strings using Swift's @propertyWrapper feature. This package allows you to validate Strings using regex in order to ensure the texts you are using comply to the format you want.

Swift 100.00%

validationkit's Introduction

ValidationKit

Swift 5.7 License: MIT

ValidationKit is a lightweight Swift library for validating strings based on custom validation rules. It uses a property wrapper to make validation simple and easy to integrate into your projects. ValidationKit is compatible with Swift 5.7 and supports various validation types such as email, phone numbers, password, and more.

Features

  • Simple and easy-to-use API
  • Customizable validation rules
  • Built-in support for common validation scenarios
  • Supports SwiftUI and Combine

Installation

To use ValidationKit in your project, add it as a dependency to your Package.swift file:

```swift
dependencies: [
    .package(url: "https://github.com/JuanColilla/ValidationKit.git", from: "1.0.0")
]
```

Then, import ValidationKit in the files where you want to use it:

```swift
import ValidationKit
```

Usage

Declare a property with the @Validated property wrapper and provide the desired validation rules:

```swift
@Validated(.notEmpty)
var username: String
```

Use the 'validationState' property to check the validation status of the value:

```swift
if username.validationState == .valid {
    print("The username is valid.")
} else {
    print("The username is not valid.")
}
```

Combine multiple validation rules for a single property:

```swift
@Validated(.email, .notEmpty)
var email: String
```

Contributing

We welcome contributions, suggestions, and bug reports. Please open an issue on the GitHub repository to discuss your ideas or report any issues you encounter.

License

ValidationKit is released under the MIT License. See the LICENSE file for more information.

validationkit's People

Contributors

juancolilla avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.