ViewControllerBuilder
public protocol ViewControllerBuilder
Type, that is capable of building a ViewController, given Context.
-
Type of
View, that thisViewControllerBuildercan build.Declaration
Swift
associatedtype ViewType : ViewController -
Argument type, that
ViewBuilderneeds to build aViewController.Declaration
Swift
associatedtype Context -
Builds a
Viewusing providedContextor throws an error, if building process was not successfulThrows
Build error, if building process was not successful.Parameters
contextArgument, required to build
ViewController.Return Value
View, that was built using providedContextobject. -
embeddedInNavigation(navigationBuilder:Extension method) Creates a
NavigationSingleViewEmbeddingBuilder, embedding current view builder in it.Declaration
Swift
public func embeddedInNavigation(navigationBuilder: @escaping () -> UINavigationController = { .init() }) -> NavigationSingleViewEmbeddingBuilder<Self>Return Value
NavigationSingleViewEmbeddingBuilderwith current builder embedded. -
pushRoute(isAnimated:Extension method) Creates a route, that uses current builder, creates a view, and pushes it onto current navigation stack.
Declaration
Swift
public func pushRoute(isAnimated: Bool = true) -> Route<Self, PushNavigationTransition>Parameters
isAnimatedshould the navigation push be animated.
Return Value
Route to view built by current builder, that will be pushed onto current navigation stack.
-
presentRoute(isAnimated:Extension method) Creates a route, that uses current builder, creates a view, and presents it on top of currently visible view.
Declaration
Swift
public func presentRoute(isAnimated: Bool = true) -> Route<Self, PresentationTransition>Parameters
isAnimatedshould the presentation be animated.
Return Value
Route to view built by current builder, that will be presented on top of currently visible view.
-
replace(_:Extension methodisAnimated: ) Creates a route that uses a current builder, creates a view, and replaces current navigation stack with a newly created view. Remaining viewControllers depend on
behavior.Declaration
Swift
public func replace(_ behavior: ReplaceNavigationTransition.Behavior = .replaceLast, isAnimated: Bool = true) -> Route<Self, ReplaceNavigationTransition>Parameters
behaviorBehavior to use when replacing view controllers in navigation stack
isAnimatedshould the presentation be animated.
-
with(_:Extension method) Combines current builder with provided
transitionto create a Route, containing them both.Declaration
Swift
public func with<T>(_ transition: T) -> Route<Self, T> where T : ViewTransitionParameters
transitiontransition to be performed when navigating to created route.
Return Value
Route, that combines current builder and
transition.
-
asAnyBuilderExtension methodConverts any
ViewControllerBuilderwith Void context to AnyBuilder, erasing it’s type.Declaration
Swift
public var asAnyBuilder: AnyBuilder { get } -
build()Extension method
View on GitHub
Install in Dash
ViewControllerBuilder Protocol Reference