SubaioViewDelegate

public protocol SubaioViewDelegate : AnyObject

Event-handlers for SubaioView.

  • Called whenever the view attempts to navigate to another page.

    Should likely be handled by pushing a new view-controller wrapping a SubaioView to the navigation-stack.

    Declaration

    Swift

    func subaioView(_ subaioView: SubaioView, navigatedTo page: Page)

    Parameters

    subaioView

    Calling view.

    page

    Page to navigate to.

  • Called whenever the view attempts to go back.

    Should likely be handled by popping the current view-controller from the stack.

    Declaration

    Swift

    func subaioViewDidSelectBack(_ subaioView: SubaioView)

    Parameters

    subaioView

    Calling view.

  • Called whenever the view changes status. It is not necessary to react to this.

    Can be used to implement a custom loading-screen by hiding the loading-screen and showing the view on a change to running or errored.

    Can be used to implement a custom error-screen by hiding the view and showing an error page on a change to errored.

    Declaration

    Swift

    func subaioView(_ subaioView: SubaioView, changedStatusTo status: ViewStatus)

    Parameters

    subaioView

    Calling view.

    status

    New status of the view.

  • Called whenever the view changes title.

    If a host-application controlled title-bar is used, this text should be shown there.

    Declaration

    Swift

    func subaioView(_ subaioView: SubaioView, updatedTitleTo title: String)

    Parameters

    subaioView

    Calling view.

    title

    Title of the view.

  • Called whenever the view receives an error.

    noTemplate and viewTimedOut should be handled by showing an error page.

    Declaration

    Swift

    func subaioView(_ subaioView: SubaioView, didReceiveError error: SubaioError)

    Parameters

    subaioView

    Calling view.

    error

    The error that the view received.

  • Called whenever the user of the view attempts to share.

    Should likely present a UIActivityViewController, like so:

    func subaioView(_ subaioView: SubaioView, isAttemptingToShare items: [Any]) {
       let activityViewController = UIActivityViewController(activityItems: items, applicationActivities: nil)
       self.present(activityViewController, animated: true, completion: nil)
    }
    

    Declaration

    Swift

    func subaioView(_ subaioView: SubaioView, isAttemptingToShare items: [Any])

    Parameters

    subaioView

    Calling view.

    item

    Item to be shared.