Open URLs without leaving the app - xamoom/xamoom-ios-sdk GitHub Wiki

Since SDK version 3.11.2 it is possible to open URLs with a given scheme in a WebViewController without leaving the app. This Controller just opens the URL and do no styling or handling of the loaded content.

This URL handling logic only works for LinkBlocks and ImageBlocks.

Usage

For using this functionality you have to set the URL scheme parameter as [String] and also the NavigationController parameter of XMMContentBlocks class.

let contentBlocks = XMMContentBlocks(tableView: tableView,
                                     api: your api)
contentBlocks?.delegate = self
    
let urls = ["google.com", "apple.com"]
contentBlocks?.urls = urls
contentBlocks?.navController = self.navigationController

Note: Like in this example, https://www.apple.com and https://developer.apple.com will be opened in the WebView because the URL contains "apple.com"

Customizing XMMWebViewController

Per default the XMMWebViewControllers navigation bar tint color is white and no topItem title is set. To change the NavigationBar color implement following code line.

contentBlocks?.webViewNavigationBarTintColor = UIColor.red

To set a title for the back button item you have to implement a string in your Localizable.strings files with "webviewcontroller.back" as key. Otherwise no title will be set.

http

Since SDK version 3.11.15, all urls starting with http will be replaced by https urls.