Protocol
PresentableInteractable
An Interactable that owns a presenter.
protocol PresentableInteractable : Interactable
Mentioned In
Overview
PresentableInteractable adds a single nonisolated presenter requirement to Interactable. The presenter is typically a @MainActor-isolated type, so calls into it from the interactor’s actor cross isolation domains and must be await-ed.
Overview
Use PresentableInteractable for any napkin that has a view; for view-less (“headless”) napkins, conform directly to Interactable. Pair this with a feature-specific Presentable protocol that the presenter conforms to:
protocol HomePresentable: Presentable {
func presentUser(_ user: User) async
}
Usage
final actor HomeInteractor: PresentableInteractable {
nonisolated let lifecycle = InteractorLifecycle()
nonisolated let presenter: HomePresentable
weak var listener: HomeListener?
init(presenter: HomePresentable) {
self.presenter = presenter
}
func didBecomeActive() async {
await presenter.presentUser(.placeholder)
}
}
See Also
Interactable
See Also
Presentable
Topics
Owning a Presenter
Associated Types
Relationships
Inherits From