Looking for some help with my iOS app. Within my app I am wanting to open clicked links from within my domain (EX: communionchapelefca.org) in WKWebView and then have links from all other domains (EX: google.com) open in Safari. I would prefer to do this progrmatically as well since that is how my code is already setup.
I have found a few solutions on stackoverflow (here, here, here, and here) but they all seem to be Obj-C based and I am looking for a solution using Swift. thanks in advance.
ViewController.swift:
import UIKit
import WebKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let myWebView:WKWebView = WKWebView(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height))
myWebView.loadRequest(NSURLRequest(URL: NSURL(string: "http://www.communionchapelefca.org/app-home")!))
self.view.addSubview(myWebView)
Xcode 9.3, Swift 4
The source: https://developer.apple.com/documentation/webkit/wkwebview