ARDeepLinkButton 1.0.1

ARDeepLinkButton 1.0.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Feb 2016
SPMSupports SPM

Maintained by alexruperez.




ARDeepLinkButton

Analytics

Overview

ARDeepLinkButton is an UIButton subclass that handle deep links, shows in-app SKStoreProductViewController or redirects to the AppStore. Written in Swift 2.0

ARDeepLinkButton Screenshot

Installation

Or you can install it with Swift Package Manager:

.Package(url: "ssh://[email protected]:alexruperez/ARDeepLinkButton.git", versions: Version(1,0,0)..<Version(2,0,0)),

Or you can add the following files to your project:

  • ARDeepLinkButton.swift
  • ARDeepLinkHandler.swift

Usage

ARDeepLinkButton is @IBDesignable and has the following properties:

@IBInspectable public var deepLink: String? // Example: "madbike://"
@IBInspectable public var iTunesURL: String? // Example: "https://itunes.apple.com/us/app/madbike/id1067596651?mt=8"
@IBInspectable public var cornerRadius: CGFloat // UIButton corner radius.
@IBInspectable public var borderWidth: CGFloat // UIButton border width.
@IBInspectable public var borderColor: UIColor? // UIButton border color.
@IBInspectable public var imageContentMode: Int // UIButton image UIViewContentMode value. Example: 1 for .ScaleAspectFit
@IBInspectable public var imageCornerRadius: CGFloat // UIButton image corner radius.
public lazy var deepLinkHandler = ARDeepLinkHandler() // Deep link handler, here you have access to SKStoreProductViewController in order to customize it.
public private(set) var appStoreId: String? // Automatically generated when iTunesURL is setted.

ARDeepLinkHandler can be used independently and has the following public methods:

public func handle(deepLink: String?, appStoreId: String?, iTunesURLString: String?) -> Bool
public func handle(appStoreId: String?, iTunesURLString: String?) -> Bool
public func handle(URLString: String?) -> Bool

iOS 9 Reminder

Add your deep link to LSApplicationQueriesSchemes in your Info.plist

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>madbike</string>
</array>

Etc.

  • Contributions are very welcome.
  • Attribution is appreciated (let’s spread the word!), but not mandatory.

Use it? Love/hate it?

Tweet the author @alexruperez, and check out alexruperez’s blog: http://alexruperez.com

License

ARDeepLinkButton is available under the MIT license. See the LICENSE file for more info.