iOS Behaviours

Specific behaviours associated with iOS

Allow WebView To be Inspectable in iOS

By default, the SDK does not allow the webview to be inspectable. You can override this behaviour and allow for the WKWebView powering the experience to be inspectable by using the following snippet:

let config = ExperienceConfiguration(
  isInspectable: true
)

let experience = Launcher.getExperience(config: config)
<yourView>.addSubview(experience)

// You need to ensure the experiences are laid out however you see fit.
// For instance, could use autolayout constraints, or setting 
// their frame

Allow Media Inline Playback in the Experience in iOS

By default, the SDK does not allow media to be played inline, meaning that all media plays fullscreen by default. You can override this behaviour and allow for inline playback by using the following snippet:

let config = ExperienceConfiguration(
  allowsInlineMediaPlayback: true
)

let experience = Launcher.getExperience(config: config)
<yourView>.addSubview(experience)

// You need to ensure the experiences are laid out however you see fit.
// For instance, could use autolayout constraints, or setting 
// their frame

Customise the URLSession used in iOS

Customising the URLSession in an iOS application allows you to adapt network requests to meet your app's specific needs.

By setting a custom URLSession instance to the URLSession.monterosaSDK, the SDK allows you to override the the URLSession that the SDK uses.

This allows to:

  • Control the timeout period

  • Control the caching

  • Meet network security requirements (such as disabling HTTP cache)

In order to override the URLSession, you'll need to set the value like so:

import MonterosaSDKConnectKit

...
let config = URLSessionConfiguration.default
// Your customisations, e.g. disable caching:
config.urlCache = nil
URLSession.monterosaSDK = URLSession(configuration: config)
...

Last updated

Was this helpful?