From bbb3eba4428eea2872d647022ddf1921bfb1f7db Mon Sep 17 00:00:00 2001 From: Brandon Stalnaker <33703490+BrandonStalnaker@users.noreply.github.com> Date: Fri, 3 Mar 2023 11:55:13 -0500 Subject: [PATCH] feat: Add SPM Support (#9) --- .gitignore | 4 ++++ Package.swift | 29 +++++++++++++++++++++++ README.md | 8 ++++++- mParticle-CleverTap/MPKitCleverTap.m | 1 - mParticle-CleverTap/mParticle_CleverTap.h | 5 +++- 5 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 Package.swift diff --git a/.gitignore b/.gitignore index f986690..35585b1 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,7 @@ fastlane/test_output **/Cartfile.resolved **/Pods KitsExample + +# Swift Package Manager +Package.resolved +.build \ No newline at end of file diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..df77169 --- /dev/null +++ b/Package.swift @@ -0,0 +1,29 @@ +// swift-tools-version:5.3 +// The swift-tools-version declares the minimum version of Swift required to build this package. +import PackageDescription + +let package = Package( + name: "mParticle-CleverTap", + platforms: [ .iOS(.v9) ], + products: [ + .library( + name: "mParticle-CleverTap", + targets: ["mParticle-CleverTap"]), + ], + dependencies: [ + .package(name: "mParticle-Apple-SDK", + url: "https://github.com/mParticle/mparticle-apple-sdk", + .upToNextMajor(from: "8.0.0")), + .package(name: "CleverTapSDK", + url: "https://github.com/CleverTap/clevertap-ios-sdk", + .upToNextMajor(from: "4.2.0")), + ], + targets: [ + .target( + name: "mParticle-CleverTap", + dependencies: ["mParticle-Apple-SDK", "CleverTapSDK"], + path: "mParticle-CleverTap", + publicHeadersPath: "." + ), + ] +) diff --git a/README.md b/README.md index d93f75e..5c7a08f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This repository contains the [CleverTap](https://clevertap.com/) integration for ### Adding the integration -1. Add the kit dependency to your app's Podfile or Cartfile: +1. Add the kit dependency to your app's Podfile, Cartfile, or through using SPM: ``` pod 'mParticle-CleverTap', '~> 7.0' @@ -15,6 +15,12 @@ This repository contains the [CleverTap](https://clevertap.com/) integration for ``` github "mparticle-integrations/mparticle-apple-integration-clevertap" ~> 7.0 ``` + + OR + + ``` + Open your project and navigate to the project's settings. Select the tab named Swift Packages and click on the add button (+) at the bottom left. then, enter the URL of CleverTap Kit GitHub repository - https://github.com/mparticle-integrations/mparticle-apple-integration-clevertap and click Next. + ``` 2. Follow the mParticle iOS SDK [quick-start](https://github.com/mParticle/mparticle-apple-sdk), then rebuild and launch your app, and verify that you see `"Included kits: { CleverTap }"` in your Xcode console diff --git a/mParticle-CleverTap/MPKitCleverTap.m b/mParticle-CleverTap/MPKitCleverTap.m index 5329114..bcaf7a3 100644 --- a/mParticle-CleverTap/MPKitCleverTap.m +++ b/mParticle-CleverTap/MPKitCleverTap.m @@ -1,6 +1,5 @@ #import "MPKitCleverTap.h" - #if defined(__has_include) && __has_include() #import #else diff --git a/mParticle-CleverTap/mParticle_CleverTap.h b/mParticle-CleverTap/mParticle_CleverTap.h index e1fcd06..70d4f0f 100644 --- a/mParticle-CleverTap/mParticle_CleverTap.h +++ b/mParticle-CleverTap/mParticle_CleverTap.h @@ -2,5 +2,8 @@ FOUNDATION_EXPORT double mParticle_ExampleVersionNumber; FOUNDATION_EXPORT const unsigned char mParticle_ExampleVersionString[]; - +#if defined(__has_include) && __has_include() #import +#else +#import "MPKitCleverTap.h" +#endif