UserActionPresenter

public protocol UserActionPresenter : AnyObject

A type for objects that can present and dismiss view controllers.

The API this protocol requires is exactly the API that UIKit uses to present and dismiss view controllers. This allows UIViewController to trivially conform to it, but doesn’t directly tie the action runner to UIKit.

Each action runner may have a presenter. Action implementations can use methods on the action context to present and dismiss view controllers. Doing so will use the presenter of the action runner that performed the action. The action runner also uses the presenter to show alerts when actions fail.

  • present(_:animated:) Default implementation

    Undocumented

    Default Implementation

    Undocumented

    Declaration

    Swift

    func present(_ viewControllerToPresent: UIViewController, animated flag: Bool)
  • Undocumented

    Declaration

    Swift

    func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)?)
  • dismiss(animated:) Default implementation

    Undocumented

    Default Implementation

    Undocumented

    Declaration

    Swift

    func dismiss(animated flag: Bool)
  • Undocumented

    Declaration

    Swift

    func dismiss(animated flag: Bool, completion: (() -> Void)?)
  • present(error:animated:) Extension method

    Present an error to the user with an alert.

    The error’s localized description and localized failure reason will be used as the title and message of the alert, respectively. The alert will have a single button to dismiss it.

    Declaration

    Swift

    func present(error: Error, animated: Bool = true)