How to: navigate external link in WebView osx Swift?

Good day, "write" your first app in Swift.

There is a WebView where I open the site:

let defaultURL = "https://yandex.ru"

override func viewDidLoad() {
 self.EasyW.frameLoadDelegate = self
 self.EasyW.policyDelegate = self
 self.EasyW.mainFrame.loadRequest(NSURLRequest(URL: NSURL(string: defaultURL)!))

}


Everything works fine but when clicking on an external link, nothing happens( How to open external link in default browser?
July 9th 19 at 13:30
1 answer
July 9th 19 at 13:32
you need to bind an action to the button (IBAction), and inside the function to register
let defaultURL = NSURL(string: "https://yandex.ru")!
UIApplication.sharedApplication().openURL(defaultURL!)

Find more questions by tags Apple XcodemacOSSwift