Appz
Deeplinking to external applications made easy
Highlights
Web Fallback Support:
In case the app can't open the external application, it will fall-back to a web URL that is guaranteed to succeed by opening the browser.Isolated App Specs:
It was crucial to make sure the library can scale as the number of supported apps increase. Therefor, each supported app is implemented in isolation in a separate file.Full Autocomplete Support: The API has been carefully designed to make the most out of auto complete features, so you don't even have to peak into any docs or code!
Full Testing:
To make the specs as transparent as possible, the library has tests to make sure every external application action has tests with the expected results.
Features
You can try them in the playground shipped with the framework!
Concise syntax to trigger deep linking:
let app = UIApplication.sharedApplication()
app.canOpen(Applications.Instagram())
app.open(Applications.AppStore(), action: .Account(id: "395107918"))
app.open(Applications.AppSettings(), action: .Open)
Transparent web fallback:
// In case the user doesn't have twitter installed, it will fallback to
// https://twitter.com/statuses/2
app.open(Applications.Twitter(), action: .Status(id: "2"))
Add your applications:
// Applications are recommended to be part of the
// "Applications" namespace
extension Applications {
// Define your application as a type that
// conforms to "ExternalApplication"
struct MyApp: ExternalApplication {
typealias ActionType = Applications.MyApp.Action
let scheme = "myapp:"
let fallbackURL = ""
}
}
// Then, you define the actions your app supports
extension Applications.MyApp {
enum Action: ExternalApplicationAction {
case Open
// Each action should provide an app path and web path to be
// added to the associated URL
var paths: ActionPaths {
switch self {
case .Open:
return ActionPaths()
}
}
}
}
app.open(Applications.MyApp(), action: .Open)
Supported Apps (for now!):
App | Actions |
---|---|
AppSettings | Open |
AppStore | Developer, App |
Open, Camera, Media, Username, Location, Tag | |
Compose | |
Messages | SMS |
Status, UserHandle, UserId, List, Post, Search, Timeline, Mentions, Messages |
Getting Started
- You must add the schemes you want to use to your app's info.plist file under
LSApplicationQueriesSchemes
. See here for more. - ... Cocoapods, Carthage, and better instructions coming soon.
Motivation
I've gone through way too much pain than I am willing to admit integrating deeplinking in my app. It is very easy to forget calling canOpenURL
or missing a colon somewhere. Another pain point was savaging the web for all the different specs for different applications.
With this library, you can keep the external application deep linking spec separately and rest assured as it is open source and maintained by the wonderful github community!
Author
Mazyod (@Mazyod)
License
Appz is released under the MIT license. See LICENSE for details.