How to open a url in system default browser by using Swift as programming language and OSX as plattform.
I found a lot with UIApplication like
UIAppl
When using Swift 3, you can open a webpage in the default browser using the following:
NSWorkspace.shared().open(NSURL(string: "https://google.com")! as URL)
In the accepted answer above, you can also check a URL using Swift 3 by inputting the following:
if let checkURL = NSURL(string: "https://google.com") {
if NSWorkspace.shared().open(checkURL as URL) {
print("URL Successfully Opened")
}
} else {
print("Invalid URL")
}
I hope that this information helps whomever it applies to.