Class
Builder
A base class for creating napkin builders with dependency injection support.
class Builder<DependencyType>
Mentioned In
Overview
Builder is a generic class that provides the foundation for constructing napkin units. It receives dependencies from its parent napkin and uses them to create child components.
Overview
The builder is responsible for:
Receiving dependencies from the parent napkin via the dependency property
Creating a Component to provide dependencies to child napkins
Instantiating the Interactable with required services
Creating the Router and wiring it to the interactor
Returning the router as the public interface to the napkin
Usage
Subclass Builder and implement a build method that constructs your napkin:
final class MyFeatureBuilder: Builder<MyFeatureDependency>, MyFeatureBuildable {
func build(withListener listener: MyFeatureListener) -> MyFeatureRouting {
let component = MyFeatureComponent(dependency: dependency)
let interactor = MyFeatureInteractor(service: component.myService)
interactor.listener = listener
return MyFeatureRouter(interactor: interactor)
}
}
See Also
Buildable
See Also
Component
See Also
Router
Topics
Creating a Builder
Relationships
Conforms To