Make type constraintes less strict (#5) Make type constraintes less strict
Make type constraintes less strict (#5)
Useful satellite for validation user inputs proposes for any SwiftUI architectures. (MVVM as basic reference)
Firstly you should define the validation publisher within your @Published property
@Published
class FormViewModel: ObservableObject { @Published var email = "" public lazy var emailValidator: ValidationPublisher = { $email.validateWithRegex( regex: RegularPattern.email, error: "Not email", tableName: nil ) }() }
Excellent! And then, call the validate view modifier from your SwiftUI Input
TextField("Should email", text: $viewModel.email) .validate(for: viewModel.emailValidator)
Enjoy!
Same steps you can apply to SecureField and Toggle.
SecureField
Toggle
Useful set of validation publishers and regular expressions library. Validation for
The CombineValidate dependes on the Combine reactive framework. Minimal requirements:
Package installation occurs via SPM. Add package in your Xcode as dependency
Look at here and explore documentation.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
CombineValidate
What is CombineValidate?
Useful satellite for validation user inputs proposes for any SwiftUI architectures. (MVVM as basic reference)
Batteries:
Examples
Basic usage
Firstly you should define the validation publisher within your
@Published
propertyExcellent! And then, call the validate view modifier from your SwiftUI Input
Enjoy!
Same steps you can apply to
SecureField
andToggle
.CombineValidateExtended library
Useful set of validation publishers and regular expressions library. Validation for
Requirements
The CombineValidate dependes on the Combine reactive framework. Minimal requirements:
Installation
Package installation occurs via SPM. Add package in your Xcode as dependency
Documentation
Look at here and explore documentation.