Framework for model validations for Swift with custom errors returned on validation.
Usage
The framework is created to be used when you want to receive custom errors on each validation. This because we don’t want to always display the error as a string but sometimes we would like to highlight not valid fields and give detailed custom information about what’s wrong with the provided data. Moreover, if we think about highlighting the fields in the form, we have to get all the validation errors at once for the better UX. This framework is designed for these use cases.
ModelValidator
Framework for model validations for Swift with custom errors returned on validation.
Usage
The framework is created to be used when you want to receive custom errors on each validation. This because we don’t want to always display the error as a string but sometimes we would like to highlight not valid fields and give detailed custom information about what’s wrong with the provided data. Moreover, if we think about highlighting the fields in the form, we have to get all the validation errors at once for the better UX. This framework is designed for these use cases.
Installation
Swift Package Manager
The preferred installation type is by using Swift Package Manager.
CocoaPods
To install the framework by using CocoaPods:
Usage
Example usage
Below you can see the simplest validation for a model.
More examples you can find in tests
Contibution
If you have some idea for a new feature, create an issue or add a pull request.
We don’t use Linux for Swift, so if you have a proposition to run it on Linux, please create a pull request with the needed changes.
The framework has no dependencies. Only things you should have is Swift compiler and SwiftLint on your machine.
Release
The package is released manually. To release register with a proper email account to pod trunk:
Make sure that you are on a commit ready for release and run release script with a proper tag name: