Listen to the WebView rendering event

This topic guides you on how to listen for the WebView rendering event.

Overview

From IAPConnect 2.36.0, Griver supports the WebView rendering event by implementing GRVRenderViewEventDelegate. The following sections provide the detailed steps:

Step 1. Implement GRVRenderViewEventDelegate

Implement the GRVRenderViewEventDelegate protocol, and implement the methods defined by the protocol:

  • Implement the custom action when a WebView render is created.

Note: Only available for H5(HTML5) apps (or pages), excluding PWAs (Progressive Web Apps).

See the following sample code:

copy
class DemoRenderEventDelegate: NSObject, GRVRenderViewEventDelegate {
    func renderView(_ webview: WKWebView, didCreateWith appType: GRVRenderViewAppType) {
        // Handle the didcreate event
    }
}

Step 2. Configure GRVExtensionDelegate for renderViewEventDelegate

See the following sample code:

copy
let extensionDelegate = GRVExtensionDelegate()
extensionDelegate.renderViewEventDelegate = DemoURLNavigationEventDelegate()