Swiftpack.co -  chickdan/SchemeKit as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
chickdan/SchemeKit
SchemeKit is a simple API to provide url query schemes for launching third party applications.
.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: 5 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Related Packages

Release Notes

0.8.1
5 weeks ago

SPM support

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