Swiftpack.co - ASATools/ios_sdk as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ASATools.
ASATools/ios_sdk 1.4.3
ASATools iOS SDK
⭐️ 0
🕓 3 days ago
iOS
.package(url: "https://github.com/ASATools/ios_sdk.git", from: "1.4.3")

ASATools

This library is part of the service ASATools

Version License

Installation

You can integrate ASATools using Cocoapods or Swift PM.


Cocoapods

Add the following line to your Podfile:

target '<Your Target Name>' do
  pod 'ASATools', '~> 1.4.0'
end

Then, run the following command:

pod install

Swift Package Manager

To integrate ASATools into your Xcode project using Swift Package Manager, add it to the dependencies value of your Package.swift:

dependencies: [
    .package(url: "https://github.com/ASATools/ios_sdk.git", .upToNextMajor(from: "1.4.0"))
]

Integration

Open AppDelegate and at the top of the file add

import ASATools

From applicationDidFinishLaunching method call:

ASATools.instance.attribute(apiToken: "your_token_here")

To get your API token please visit ASATools dashboard.

API Key location

Handle attribution data (optional)

If you want store attribution data or pass it to your product analytics, you can use AttributionResponse from completion block.

ASATools.instance.attribute(apiToken: "your_token_here") { response, error in
  if let response = response {
    // pass response.analyticsValues() to your product analytics
    Amplitude.instance.setUserProperties(response.analyticsValues())
    Amplitude.instance.logEvent("did_receive_asa_attribution", withEventProperties: response.analyticsValues())
  }
}

Note, that completion block will only be called once if there is a success response.

Author

vdugnist, [email protected]

License

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

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