The macro synthesis for the method withMutation
is user-replaceable.
internal nonisolated func withMutation<Member>(of keyPath: KeyPath<UserInput, Member>, _ mutation: () throws -> T) rethrows {
defer { if keyPath != \.validValue { onValueChange() } }
return try _$observationRegistrar.withMutation(of: self, keyPath: keyPath, mutation)
}
That would replicate what the macro does for mutations and add that value validation. It is worth noting that check on the key path is required to prevent recursion.