Tiledesk Docs
Search…
Integrate Widget for iOS with WKWebView
This example shows how to integrate the Tiledesk Widget for iOS

Controller

1
//
2
// WebViewViewController.swift
3
// Tiledesk
4
//
5
6
import UIKit
7
import WebKit
8
9
class WebViewViewController: UIViewController, WKUIDelegate {
10
11
@IBOutlet weak var webView: WKWebView!
12
@IBAction func actionClosing(_ sender: UIBarButtonItem) {
13
dismiss(animated: true, completion: nil)
14
}
15
16
override func loadView() {
17
18
let image = UIImage(named: "ic_navigation_bar")!
19
let nav = self.navigationController?.navigationBar
20
let tintColor = UIColor(red: 51, green: 71, blue: 94, alpha: 1)
21
nav?.setupNavigationBar(barStyleBlack: true, tintColor: tintColor, image: image)
22
23
24
let webConfiguration = WKWebViewConfiguration()
25
webView = WKWebView(frame: .zero, configuration: webConfiguration)
26
webView.uiDelegate = self
27
view = webView
28
}
29
30
31
32
override func viewDidLoad() {
33
super.viewDidLoad()
34
let url = "https://widget.tiledesk.com/v5/assets/twp/index.html?tiledesk_projectid=<CHANGE_IT>&tiledesk_fullscreenMode=true&tiledesk_hideHeaderCloseButton=true&tiledesk_isOpen=true"
35
let myURL = URL(string:url)
36
let myRequest = URLRequest(url: myURL!)
37
webView.load(myRequest)
38
}
39
40
41
/*
42
// MARK: - Navigation
43
44
// In a storyboard-based application, you will often want to do a little preparation before navigation
45
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
46
// Get the new view controller using segue.destination.
47
// Pass the selected object to the new view controller.
48
}
49
*/
50
51
}
Copied!
Find here other widget parameters to customize your experience.

Web View Controller

Create a Web View Controller in your Story Board and add a WebView as below:
Last modified 17d ago