Skip to content

Commit

Permalink
feat: unify field factory signature
Browse files Browse the repository at this point in the history
  • Loading branch information
r13v committed Jul 13, 2023
1 parent d1b326b commit d03e2f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions EffectorForms/EffectorForm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ public final class EffectorForm<Values: FormValues> {
public func field<Value: Equatable>(
keyPath: KeyPath<Values, Value>,
initialValue: @autoclosure @escaping () -> Value,
rule: ValidationRule<Value, Values>?
rules: ValidationRule<Value, Values>?
) -> EffectorFormField<Value, Values> {
EffectorFormField(
.init(
keyPath: keyPath,
initialValue: initialValue(),
rules: rule != nil ? [rule!] : []
rules: rules != nil ? [rules!] : []
)
)
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/EffectorFormsTests/FormTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ final class FormTests: XCTestCase {
let email = form.field(
keyPath: \.email,
initialValue: "",
rule: .email()
rules: .email()
)
let password = form.field(
keyPath: \.password,
initialValue: "",
rule: .min(6)
rules: .min(6)
)

form.register(field: email)
Expand Down

0 comments on commit d03e2f9

Please sign in to comment.