Swiftpack.co - chickdan/SchemeKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by chickdan.
chickdan/SchemeKit v0.8
SchemeKit is a simple API to provide url query schemes for launching third party applications.
⭐️ 2
🕓 2 years ago
.package(url: "https://github.com/chickdan/SchemeKit.git", from: "v0.8")

SchemeKit

SchemeKit is a simple API to provide url query schemes for launching third party applications.

GitHub License Carthage compatible Language Platform

Installation

Carthage github "chickdan/SchemeKit"

Usage

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>

Contribution

Issue

If you find a bug or need a help, you can create an issue

Pull Request

We are happy to accept pull requests!

GitHub

link
Stars: 2
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

0.8.1
2 years ago

SPM support

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics