Closed siemensikkema closed 6 years ago
Merging #12 into master will decrease coverage by
2.79%
. The diff coverage is0%
.
@@ Coverage Diff @@
## master #12 +/- ##
=========================================
- Coverage 76.23% 73.43% -2.8%
=========================================
Files 19 21 +2
Lines 446 463 +17
Branches 22 22
=========================================
Hits 340 340
- Misses 106 123 +17
Impacted Files | Coverage Δ | |
---|---|---|
Sources/Forms/ValidatorWrapper.swift | 0% <0%> (ø) |
|
Sources/Forms/Validation+convenience.swift | 0% <0%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update fe3588e...9898a33. Read the comment docs.
A possible improvement would be to add a closure instead that takes the original error and throws a new one depending on the error instead of a single error. The current functionality (as proposed in this PR) could be maintained by creating another initializer that takes an error value and calls the initializer taking a closure with a closure that just returns the given error value.
Allows for example:
which allows uses an existing (e.g. StrongPassword) validator but transforms the errors into something more suited to your needs and also adds a requirement that the value be non-nil.