BridgeViewDelegate

public protocol BridgeViewDelegate : AnyObject

Event-handlers for BridgeView.

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

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

    Declaration

    Swift

    func bridgeView(_ bridgeView: BridgeView, navigatedTo page: Page)

    Parameters

    bridgeView

    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 bridgeViewDidSelectBack(_ bridgeView: BridgeView)

    Parameters

    bridgeView

    Calling view.

  • bridgeView(_:changedStatusTo:) Default implementation

    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.

    Default Implementation

    Declaration

    Swift

    func bridgeView(_ bridgeView: BridgeView, changedStatusTo status: ViewStatus)

    Parameters

    bridgeView

    Calling view.

    status

    New status of the view.

  • bridgeView(_:updatedTitleTo:) Default implementation

    Called whenever the view changes title.

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

    Default Implementation

    Declaration

    Swift

    func bridgeView(_ bridgeView: BridgeView, updatedTitleTo title: String?)

    Parameters

    bridgeView

    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 bridgeView(_ bridgeView: BridgeView, didReceiveError error: ViewError)

    Parameters

    bridgeView

    Calling view.

    error

    The error that the view received.

  • bridgeView(_:resizedTo:) Default implementation

    Called whenever the content of the view resizes. This event is only called if reportResize is set to true in the BridgeView constructor.

    Default Implementation

    Declaration

    Swift

    func bridgeView(_ bridgeView: BridgeView, resizedTo height: Int)

    Parameters

    bridgeView

    Calling view.

    height

    The height in device-independent pixels

  • Called when a custom event is sent. Custom event names and payloads should be agreed upon between host and embedded app.

    Default Implementation

    Declaration

    Swift

    func bridgeView(_ bridgeView: BridgeView, receivedCustomEvent name: String, data: Any?)

    Parameters

    bridgeView

    Calling view.

    name

    The name of the event.

    data

    Varies depending on the name.