Skip to content

giiiita/Lune

Repository files navigation

Lune

Dynamic Link Wrapper Library for iOS

Version License Platform

Usage

There's only three steps to using Lune:

Create a structure and make it conform to LinkContract.

This structure writes the basic settings of dynamicLink.

If you do not know what to set, please check on the official site

struct LinkConfig: LinkContract {

    var dynamicLink: String = ""

    var domainURIPrefix: String = ""

    var bundleId: String = ""

    var appStoreId: String = ""

    var fallbackUrl: String = ""

    var isForcedRedirectEnabled: Bool = false

    var socialParams: SocialContract

    init(socialParams: SocialContract) {
        self.socialParams = socialParams
    }

}

Create a structure and make it conform to SocialContract.

This structure writes about preview settings.

struct SocialParams: SocialContract {

    var title: String

    var description: String

    var imageURL: URL
    
    init(title: String, description: String, imageURL: URL) {
        self.title = title
        self.description = description
        self.imageURL = imageURL
    }
}

The callback will return short url, long url and error.

let social: SocialContract = SocialParams(
    title: self.product.title,
    description: self.product.description,
    imageURL: self.product.thumbnail.downloadURL
    )
        
 let link: LinkContract = LinkConfig(socialParams: social)
 let params: [String: String] = ["productId": self.product.id]

 Lune.shared.build(linkParams: link, urlParams: params) { (s, l, e) in
 }

Requirements

Installation

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

pod 'Lune'

About

Dynamic Link Wrapper Library for iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published