ModalUIViewControllerPresenter

open class ModalUIViewControllerPresenter : FlowPresentationDelegate

This FlowPresentationDelegate implementation handles the screen presentation in such a way, that every present call results in a modal presentation on the top-most view controller.

Important: This implementation requires that every present call have their own dismiss call pair. Self dismissing view controllers such as UIAlertControllers are not supported.

  • Property to set the screen animation true/false

    Declaration

    Swift

    public var animated: Bool
  • The presentation style for modally presented view controllers.

    Declaration

    Swift

    public var modalPresentationStyle: UIModalPresentationStyle?
  • The transition style for modally presented view controllers.

    Declaration

    Swift

    public var modalTransitionStyle: UIModalTransitionStyle?
  • Class initializer

    Declaration

    Swift

    public init(topPresentedViewControllerHandler: @escaping (UIViewController?) -> UIViewController? = topPresentedViewController)

    Parameters

    topViewControllerHandler

    function to find the top viewcontroller

  • The presentation state: provides information for the users of the delegate about the state of the OnboardingFlow

    Declaration

    Swift

    open var state: PresentationState { get set }
  • Setter function to set the received screen as splashscreen

    Declaration

    Swift

    open func setSplashScreen(_ splashScreen: UIViewController & InfoTextSettable)

    Parameters

    splashScreen

    UIViewController type which also conforms to InfoTextSettable protocol

  • Sets the splashScreen property to nil

    Declaration

    Swift

    open func clearSplashScreen()
  • Undocumented

    Declaration

    Swift

    open func resetPreserveData()
  • FlowPresentationDelegate protocol setInfoText() implementation

    Declaration

    Swift

    open func setInfoText(_ text: String)

    Parameters

    text

    String to set as infoScreenText

  • FlowPresentationDelegate protocol present() implementation

    Declaration

    Swift

    open func present(_ viewController: UIViewController, completionHandler: @escaping (Error?) -> Void)

    Parameters

    viewController

    UIViewController to present

    completionHandler

    called when the process finished. Error filled on failure.

  • FlowPresentationDelegate protocol dismiss() implementation Dismisses the presented UIViewController

    Declaration

    Swift

    open func dismiss(completionHandler: @escaping (Error?) -> Void)

    Parameters

    completionHandler

    called when the process finished. Error filled on failure.

  • Finds the topViewController in the view hierarchy

    Declaration

    Swift

    public static func topPresentedViewController(base: UIViewController? = ModalUIViewControllerPresenter.findRootViewController(of: SceneManager.shared.getCurrentOnboardingScene())) -> UIViewController?

    Parameters

    base

    UIViewController to check if it is the top view controller

    Return Value

    the top UIViewController

  • Undocumented

    Declaration

    Swift

    public static func findRootViewController(of scene: UIScene?) -> UIViewController?