XCFramework is a type of binary library package that allows you to use third-party libraries in your iOS (version 14.5 and below) apps. Kount has a release of the Device Data Collector (DDC) XCFramework package – which can simplify integrating the DDC into your app. XCFramework packages can be integrated directly into an app that does not use a package manager or uses the Swift Package Manager.
Adding the Kount Device Data Collector XCFramework package directly
- Navigate to Kount iOS SDKs, and then download the kount-ios-sdk project.
- In the XCode navigator, click File then Add Files to your Project.
- In the kount-ios-sdk project, select KountDataCollector.xcframework.
- Select Copy items if needed and Create groups, and then click Add.
- Add the folder for touch event related files (for reference) under project target.
- Go to the Xcode navigator, click File, and then select Add Files to your Project.
- In the kount-ios-sdk project, select KountDataCollectorUniversalLibrary.
- Under KountDataCollectorUniversalLibrary, select TouchControls – which contains touch events related files.
- Select Copy items if needed and Create groups, and then click Add.
For Swift applications:
-
Create a Bridging Header file, and then add the below line to the file:
#import “KDataCollector.h”
#import "KountAnalyticsViewController.h" - In the target build settings, open Swift Compiler, General, Objective-C Bridging Header, and then add:
<project-name>-Bridging-Header.h
To validate the framework has been added to your project:
- Click on your project in the project navigator to open your project settings.
- Select your target, and then open the General tab.
- Scroll to Frameworks, Libraries, and Embedded Content settings.
- On the newly-added KountDataCollector.xcframework, select Embed and Sign.
- If you don’t see KountDataCollector.xcframework, you must add it manually:
- Click the Plus (+) button.
- Select the KountDataCollector.xcframework.
- Click Add.
Adding the Kount Device Data Collector XCFramework Package in Swift Package Manager
- Navigate to Kount iOS SDKs, and then download the kount-ios-sdk project.
- In your Swift Package Manager project, open the project navigator, and then right-click the Sources folder.
- Select Show in finder, and then from the kount-ios-sdk project, copy KountDataCollector.xcframework into the Sources folder.
- In the project navigator, navigate to the Package.swift file.
- Add the KountDDCPackage to the Package.swift file’s library and targets sections. An example of this is shown here:
import PackageDescription
let package = Package(
name: "KountDDCPackage",
products: [
.library(
name: "KountDDCPackage",
targets: ["KountDDCPackage","KountDataCollector"]),
],
dependencies: [],
targets: [
.target(
name: "KountDDCPackage",
dependencies: []),
.testTarget(
name: "KountDDCPackageTests",
dependencies: ["KountDDCPackage"]),
.binaryTarget(name: "KountDataCollector", path: "./Sources/KountDataCollector.xcframework")
]
) - Save and build your project.
Adding the Kount Device Data Collector Swift Package
- In Finder, navigate to the location where you saved the Kount Device Data Collector Swift package.
- Drag and drop the package into your project.
- In the project navigator, open your project settings.
- Select your target, and then open the General tab.
- Scroll down to Frameworks, Libraries, and Embedded Content settings.
- Click the Plus (+) button.
- Select the library target of the Swift Package, and then click Add.
- Create a Bridging Header file, and then add the following line to the file:
#import “KDataCollector.h”
#import "KountAnalyticsViewController.h" - In the target build settings, go to Swift Compiler, General, Objective C Bridging Header, and then add:
<project-name>-Bridging-Header.h
- Add the folder for touch-event related files (for reference) under project target:
- Go to the Xcode navigator, click File, and then click Add Files to your Project.
- In the kount-ios-sdkproject, select KountDataCollectorUniversalLibrary.
- Under KountDataCollectorUniversalLibrary, select TouchControls – which contains touch events related files.
- Select Copy items if needed and Create groups, and then click Add.
NOTE: If you are using Xcode version less than 12.0, you must comment out or delete the interface and implementation of UIColorWell code in both the UIControl+CustomControl.h and UIControl+CustomControl.m files.
- Once you have added the KountDataCollector to you project, continue to the second step (runtime implementation).
For Objective-C integration, refer to How to Invoke the Kount iOS SDK 4.1.5 Inside an Objective-C App.
For Swift integration, refer to How to Integrate the Kount iOS SDK 4.1.5 into a Swift App.
Comments
0 comments
Please sign in to leave a comment.