Wireframe

public protocol Wireframe : ControllerContainer

Undocumented

  • The top view controller currently used in your application

    Declaration

    Swift

    var topViewController: UIViewController? { get }
  • dismiss the top view controller of your application

    Declaration

    Swift

    func dismissTopViewController(animated:Bool, completion: @escaping ()->Void)

    Parameters

    completion

    completion called after controller was dismissed

  • 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

    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

    func route(url: URL, parameters: [String : Any], option: RoutingOption?, completion: @escaping () -> Void) throws

    Parameters

    url

    the route of the view controller to be presented

    option

    how should your view controller be presented

    parameters

    a dictionary of parameters (data) send to the presented view controller

    completion

    function called when the view controller was presented

  • Return the view controller for a given url

    Declaration

    Swift

    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

    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

    func add(priority: Int, responsibleFor: @escaping (_ routeResult: 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

    func add(controllerProvider: ControllerProvider, priority: Int)

    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 routing options for a route

    Declaration

    Swift

    func add(optionProvider: RoutingOptionProvider, priority: Int)

    Parameters

    optionProvider

    instance providing routing options for a route

    priority

    The priority for calling your provider, higher priorities are called last. (Defaults to 0)

  • Add an instance providing a presenter for a route

    Declaration

    Swift

    func add(presenterProvider: PresenterProvider, priority: Int)

    Parameters

    provider

    instance providing a presenter

    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

    func add(routingObserver: RoutingObserver, priority: Int, routePattern: String?)

    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

    func add(routingPresenter: RoutingPresenter, priority: Int)

    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

    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 resolver, higher priorities are called first. (Defaults to 0)

  • Add an instance responsible for dismissing controllers

    Declaration

    Swift

    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

    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

    func controllerToNavigate(matches: (_ controller: UIViewController?) -> Bool) -> UIViewController?