Michael Long
Feb 12, 2025

--

Usually find that it works better to make validation rules a struct that conforms to a Validate protocol, then adding rules to a set of rules for each field.

That makes it easier, for example, to have a ruleset that combines rules like [.required, .isAmount, .min(5.00), .max(10_000)].

--

--

Michael Long
Michael Long

Written by Michael Long

I write about Apple, Swift, and SwiftUI in particular, and technology in general. I'm also a Lead iOS Engineer at InRhythm, a modern digital consulting firm.

Responses (1)