-
-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Checklist
- Reviewed the README and documentation.
- Checked existing issues & PRs to ensure not duplicated.
Description
Support managing a class instance with Coordinator like UIViewRepresentable instead of context.addTermination and context.keepUntilTermination.
Example Use Case
struct ExampleManagerAtom: ValueAtom, Hashable {
final class Coordinator: ExampleDelegate {
func delegateMethod() { ... }
}
func makeCoordinator() -> Coordinator {
Coordinator()
}
func value(context: Context) -> ExampleManager {
let manager = ExampleManager()
manager.delegate = context.coordinator
return manager
}
}Alternative Solution
N/A
Proposed Solution
- Add an associated type
Coordinatorwhich is Void by default. - Add
makeCoordinator() -> Coordinatormethod which is empty by default. - Maintain
coordinatorinstance in core system and terminate it when the atom state is invalidated.
Motivation & Context
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request