-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Each of your fields could contain a list of validation tags then when you call your validator either use different keys to fetch the validator or make a validator which take the tags and the string to produce your validation. That’s could be like |
Beta Was this translation helpful? Give feedback.
-
Hi @ylorn, we mention this briefly in our Reducer Protocol in Practice episode (~42:58), but it seems like reusable components don't necessarily need to leverage the Instead, the struct ReusableDualTextFields: ReducerProtocol {
let validator1: Validator
let validator2: Validator
…
} And then at the moment of creating ReusableDualTextFields(
validator1: { $0.count > 5 },
validator2: { $0.count < 3 }
) There's a chance that |
Beta Was this translation helpful? Give feedback.
Hi @ylorn, we mention this briefly in our Reducer Protocol in Practice episode (~42:58), but it seems like reusable components don't necessarily need to leverage the
@Dependency
system. And sometimes probably shouldn't.Instead, the
ReusableDualTextFields
should probably take its two validation dependencies explicitly, like in the old days of environment:And then at the moment of creating
ReusableDualTextFields
you can specify which validator to use:There's a chance that
Validator
doesn't …