Updated over a month ago
We want to create the best experience possible for you. You have no need to update SDK anymore, since it’s in the web view we will handle the heavy lifting for you. You will get the latest updates and new features as soon as they are uploaded on our servers.
You will be working with our iframe URL’s
Comment widget iframe looks like this:
Required parameters (for comment widget iframe):
Emote widget iframe looks like this:
Required parameters (for emote widget iframe):
If you have any additional options to include, please contact support@vuukle.com
Integration Steps
WKWebView is still not available on Interface Builder. However, it is very easy to add them via code.
import WebKit
override func viewDidLoad() {
super.viewDidLoad()
// MARK: - Create WKWebView with configuration
let configuration = WKWebViewConfiguration()
let wkWebView = WKWebView(frame: "your frame", configuration: configuration)
// MARk: - Add WKWebView to main view
self.view.addSubview(wkWebView)
let urlName = "yourUrl"
if let url = URL(string: urlName) {
wkWebView.load(URLRequest(url: url))
}
}
private func clearAllCookies() {
let cookieJar = HTTPCookieStorage.shared
for cookie in cookieJar.cookies! {
cookieJar.deleteCookie(cookie)
}
}
private func clearCookiesFromSpecificUrl(yourUrl: String) {
let cookieStorage: HTTPCookieStorage = HTTPCookieStorage.shared
let cookies = cookieStorage.cookies(for: URL(string: yourUrl)!)
for cookie in cookies! {
cookieStorage.deleteCookie(cookie as HTTPCookie)
}
}
Note : your main ViewController must extends WKUIDelegate.
// MARK: - Show confirm alert
func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) {
let alertController = UIAlertController(title: nil, message: message, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (action) in
completionHandler(true)
}))
alertController.addAction(UIAlertAction(title: "Cancel", style: .default, handler: { (action) in
completionHandler(false)
}))
self.present(alertController, animated: true, completion: nil)
}
Note : your main ViewController must extends WKUIDelegate.
private var isPopUpAppeared = false
// MARK: - Show authorization tab
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
if navigationAction.targetFrame == nil {
let popup = WKWebView(frame: self.view.frame, configuration: configuration)
popup.uiDelegate = self
self.view.addSubview(popup)
isPopUpAppeared = true
return popup
}
return nil
}
// MARK: - Close authorization tab
func webViewDidClose(_ webView: WKWebView) {
if isPopUpAppeared {
webView.removeFromSuperview()
}
}
The full application example you can check here