ARDeepLinkButton

1.0.1

#UIButton subclass that handle deep links, shows in-app #SKStoreProductViewController or redirects to the #AppStore. Written in #Swift 2.1.1
alexruperez/ARDeepLinkButton

What's New

ARDeepLinkButton 1.0.1

2016-02-01T10:17:14Z

Added documentation.

ARDeepLinkButton

Join the chat at https://gitter.im/alexruperez/ARDeepLinkButton Twitter CI Status Version License Platform 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

ARDeepLinkButton is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "ARDeepLinkButton"

Or you can install it with Swift Package Manager:

.Package(url: "ssh://git@github.com:alexruperez/ARDeepLinkButton.git", versions: Version(1,0,0)..<Version(2,0,0)),

Or you can install it with Carthage:

github "alexruperez/ARDeepLinkButton"

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.

Description

  • Swift Tools
View More Packages from this Author

Dependencies

  • None
Last updated: Tue Jan 31 2023 09:48:57 GMT-1000 (Hawaii-Aleutian Standard Time)