AnyBuilder
public struct AnyBuilder : ViewControllerBuilder
Type-erased wrapper for ViewControllerBuilder. It can be used to shorten ViewControllerBuilder signatures in cases, where generic type information is not needed by consumer of the Route.
Another reason to do this if this generic information obstructs your usage of ViewControllerBuilders, for example in cases where you want to create a UITabBarController with array of builders, and each of them has completely different type. In this case, you can convert them to array of AnyBuilder objects.
For example, when using navigation view builder, signature can become pretty long - NavigationSingleViewEmbeddingBuilderbuilder.asAnyBuilder
which wraps builder in the AnyBuilder, which can be now used as return type that is much shorter.
-
Creates
AnyBuilderinstance.Declaration
Swift
public init<T>(builder: T, context: T.Context) where T : ViewControllerBuilderParameters
builderbuilder, whose type is going to be erased.
contextContext to be used when building
ViewController -
Creates
AnyBuilderinstanceDeclaration
Swift
public init<T>(builder: T) where T : ViewControllerBuilder, T.Context == VoidParameters
builderbuilder, whose type is going to be erased.
-
Creates
AnyBuilderinstanceDeclaration
Swift
public init<T>(buildingBy: @escaping () throws -> T) where T : ViewControllerParameters
buildingByclosure to build
ViewControllerwhen Route is executed. -
Builds
ViewControllerby runningbuilderclosure.Declaration
Swift
public func build(with context: ()) throws -> ViewControllerParameters
contextcontext is always Void, because Builder and Context types have been erased and are unknown at this point.
View on GitHub
Install in Dash
AnyBuilder Structure Reference