ValidationRules are used for automatic validation of text during input. All rules that have not passed the validation come with the failedValidationRules.
InputRules are used to prevent incorrect input.
You can also use a .formView() modifier instead of FormView:
ScrollView(.vertical) {
...
}
.formView()
Example Project
ExampleApp provides several more interesting use cases of FormView.
FormView
An easy-to-use SwiftUI library for working with a group of TextFields.
Features
Usage
ValidationRules
are used for automatic validation of text during input. All rules that have not passed the validation come with thefailedValidationRules
.InputRules
are used to prevent incorrect input.You can also use a
.formView()
modifier instead ofFormView
:Example Project
ExampleApp provides several more interesting use cases of FormView.
Installation
Swift Package Manager
The Swift Package Manager is a tool for automating the distribution of Swift code.
In Xcode 14 or later, select
File > Add Packages...
In the search bar, typeThen proceed with installation.
You can add FormView as a dependency to the
dependencies
value of yourPackage.swift
:License
FormView is released under the MIT license. See LICENSE for details.