You can use MetaCodable macro library I created.
Post
Replies
Boosts
Views
Activity
I changed my approach to use ViewModifiers as which allows me to use existing view for callback:
@MainActor
struct AsyncStateModifier<T: Equatable>: ViewModifier {
let input: T
let action: (T) async -> Void
let queue: AsyncActionQueue
func body(content: Content) -> some View {
return content
.onChange(of: input, initial: true) { old, new in
queue.process(action: action, with: new)
}
}
}