DefaultWireframe
open class DefaultWireframe : Wireframe, HasControllerContainer
Undocumented
-
Undocumented
Declaration
Swift
public let controllerContainer: ControllerContainer
-
init(router:composedOptionProvider:routingHandlerContainer:composedControllerProvider:composedPresenterProvider:composedRoutingPresenter:routingDelegate:composedRoutingObserver:routeResultHandler:topControllerResolver:controllerDismisser:controllerContainer:)
Undocumented
Declaration
Swift
public init( router : Router = DefaultRouter(), composedOptionProvider: ComposedRoutingOptionProvider = DefaultComposedRoutingOptionProvider(), routingHandlerContainer: RoutingHandlerContainer = DefaultRoutingHandlerContainer(), composedControllerProvider: ComposedControllerProvider = DefaultComposedControllerProvider(), composedPresenterProvider: ComposedPresenterProvider = DefaultComposedPresenterProvider(), composedRoutingPresenter: ComposedRoutingPresenter = DefaultComposedRoutingPresenter(), routingDelegate: RoutingDelegate = DefaultRoutingDelegate(), composedRoutingObserver: ComposedRoutingObserver = DefaultComposedRoutingObserver(), routeResultHandler: RouteResultHandler = DefaultRouteResultHandler(), topControllerResolver: ComposedTopControllerResolver = DefaultComposedTopControllerResolver(), controllerDismisser: ComposedControllerDimisser = DefaultComposedControllerDismisser(), controllerContainer: ControllerContainer = DefaultControllerContainer() )
-
Declaration
Swift
open var topViewController: UIViewController? { get }
-
Declaration
Swift
open func dismissTopViewController(animated:Bool,completion: @escaping ()->Void)
-
Check if a route pattern matching this url was added to the wireframe. Be careful, if you don’t route to a handler (but to a controller), it’s possible that no ControllerProvider or RoutingOptionProvider for this controller exists.
Declaration
Swift
open func canRoute(url: URL, parameters: [String : Any], option: RoutingOption?) throws -> Bool
Parameters
url
the url to check for resolution
parameters
the parameters (data) given to the controller
Return Value
Can the wireframe find a route for the given url
-
Route to a new route presenting a view controller
Throws
throws an error when no controller and/or option provider can be found.Declaration
Swift
open func route(url: URL, parameters: [String : Any] = [:], option: RoutingOption? = nil, completion: @escaping () -> Void = {}) throws
Parameters
url
the route of the view controller to be presented
option
how should your view controller be presented (default is nil)
parameters
a dictionary of parameters (data) send to the presented view controller (default is empty dict)
completion
function called when the view controller was presented (default is empty completion)
-
Return the view controller for a given url
Declaration
Swift
open func controller(url: URL, parameters: [String : Any]) throws -> UIViewController?
Parameters
url
url
parameters
parameters
Return Value
nil if no controller was found, the found controller otherwise
-
Register a route pattern for routing. You have to register a route pattern to allow the wireframe matching it. This is done automatically if you are using a ViewFeature from SwiftyVISPER as ControllerProvider.
Declaration
Swift
open func add(routePattern: String) throws
Parameters
pattern
the route pattern to register
-
Register a handler for a route pattern The handler will be called if a route matches your route pattern. (you dont’t have to add your pattern manually in this case)
Declaration
Swift
open func add(priority: Int, responsibleFor: @escaping (RouteResult) -> Bool, handler: @escaping RoutingHandler) throws
Parameters
priority
The priority for calling your handler, higher priorities are called first. (Defaults to 0)
responsibleFor
nil if this handler should be registered for every routing option, or a spec
handler
A handler called when a route matches your route pattern
-
Add an instance providing a controller for a route
Declaration
Swift
open func add(controllerProvider: ControllerProvider, priority: Int = 0)
Parameters
controllerProvider
instance providing a controller
priority
The priority for calling your provider, higher priorities are called first. (Defaults to 0)
-
Add an instance providing a presenter for a route
Declaration
Swift
open func add(presenterProvider: PresenterProvider, priority: Int = 0)
Parameters
provider
instance providing a presenter
priority
The priority for calling your provider, higher priorities are called first. (Defaults to 0)
-
Add an instance providing routing options for a route
Declaration
Swift
open func add(optionProvider: RoutingOptionProvider, priority: Int = 0)
Parameters
optionProvider
instance providing routing options for a route
priority
The priority for calling your provider, higher priorities are called first. (Defaults to 0)
-
Add an instance observing controllers before they are presented
Declaration
Swift
open func add(routingObserver: RoutingObserver, priority: Int = 0, routePattern: String? = nil)
Parameters
routingObserver
An instance observing controllers before they are presented
priority
The priority for calling your provider, higher priorities are called first. (Defaults to 0)
routePattern
The route pattern to call this observer, the observer is called for every route if this pattern is nil
-
Add an instance responsible for presenting view controllers. It will be triggert after the wireframe resolves a route
Declaration
Swift
open func add(routingPresenter: RoutingPresenter,priority: Int = 0)
Parameters
routingPresenter
An instance responsible for presenting view controllers
priority
The priority for calling your provider, higher priorities are called first. (Defaults to 0)
-
Add a instance responsible for finding the top view controller on an other vc
Declaration
Swift
open func add(topControllerResolver: TopControllerResolver, priority: Int)
Parameters
topControllerResolver
instance responsible for finding the top view controller on an other vc
priority
The priority for calling your provider, higher priorities are called first. (Defaults to 0)
-
Add an instance responsible for dismissing controllers
Declaration
Swift
open func add(controllerDimisser: ControllerDismisser, priority: Int)
Parameters
controllerDimisser
an instance responsible for dismissing controllers
priority
The priority for calling your dismisser, higher priorities are called first. (Defaults to 0)
-
Add a controller that can be used to navigate in your app. Typically this will be a UINavigationController, but it could also be a UITabbarController if you have a routing presenter that can handle it. Be careful you can add more than one viewControllers if your RoutingPresenters can handle different controller types or when the active ‘rootController’ changes. The last added controller will be used first. The controller will not be retained by the application (it is weakly stored), you need to store a link to them elsewhere (if you don’t want them to be removed from memory).
Declaration
Swift
open func navigateOn(_ controller: UIViewController)
Parameters
controller
a controller that can be used to navigte in your app
-
return the first navigatableController that matches in a block
Declaration
Swift
open func controllerToNavigate(matches: (UIViewController?) -> Bool) -> UIViewController?
-
delegate removement of a controller to navigate
Declaration
Swift
open func remove(controller: UIViewController)