SchemeKit is a simple API to provide url query schemes for launching third party applications.
Carthage
github "chickdan/SchemeKit"
import SchemeKit
You can use one of the built in checkers to see if your prefered browser is installed:
let installed = BrowserScheme.isChromeInstalled()
Or you can use the BrowserNames
enum to check to see if a specific browser is installed:
let chosenBrowser = BrowserNames.chrome
let installed = BrowserScheme.isBrowserInstalled(browserName: chosenBrowser)
Once you know if the browser is installed, an updated url can be generated for the browser of choice:
let url = "https://www.google.com"
let chosenBrowser = BrowserNames.chrome
if BrowserScheme.isBrowserInstalled(browserName: chosenBrowser) {
//results in a URL object with the path of: "googlechromes://www.google.com"
let chromeUrl = BrowserScheme.getUrlForBrowser(urlToConvert: url, browserName: chosenBrowser)
}
NOTE: Be sure to add schemes you plan to use in your app's info.plist
<key>LSApplicationQueriesSchemes</key>
<array>
<string>googlechrome</string>
<string>firefox</string>
<string>microsoft-edge</string>
<string>opera</string>
<string>dolphin</string>
<string>brave</string>
</array>
If you find a bug or need a help, you can create an issue
We are happy to accept pull requests!
link |
Stars: 2 |
Last commit: 2 years ago |
SPM support
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics