NavigationInstruction

public enum NavigationInstruction

Used by a RoutableWithConfiguration inside its RoutableWithConfiguration.navigationConfiguration to describe the kind of navigation to perform when handling a NavigationRequest.

   extension ListViewController: RoutableWithConfiguration {

     // needed by the `Routable` protocol
     // to identify this ViewController in the hierarchy
     var routeIdentifier: RouteElementIdentifier {
       return "listScreen"
     }

     // the `NavigationRequest`s that this ViewController is handling
     // with the `NavigationInstruction` to execute
     var navigationConfiguration: [NavigationRequest: NavigationInstruction] {
       return [
         .show("addItemScreen"): .presentModally({ [unowned self] _ in
           let vc = AddItemViewController(store: self.store)
           return vc
         })
       ]
   }
  • Define one of the two possible behaviours when dismissing a modal ViewController:

    .soft: dismiss the ViewController but keep all the presented ViewControllers

    .hard: the usual UIKit behaviour, dismiss the ViewController and all the ViewControllers that is presenting

    See more

    Declaration

    Swift

    public enum ModalDismissBehaviour
  • Push the ViewController using UINavigationController.pushViewController(:animated:).

    Declaration

    Swift

    case push((_ context: Any?) -> UIViewController)
  • pop

    Pop the ViewController using UINavigationController.popViewController(animated:).

    Declaration

    Swift

    case pop
  • Present the ViewController modally using UIViewController.present(:animated:completion:).

    Declaration

    Swift

    case presentModally((_ context: Any?) -> UIViewController)