From 5dc0509711b912dc8be7d93aba525710986c5ed8 Mon Sep 17 00:00:00 2001 From: Ben Baron Date: Fri, 19 Jan 2024 15:17:33 -0500 Subject: [PATCH] feat: Add SPM support --- Cartfile | 2 +- Package.swift | 34 +++++++++++++++++++++++++ README.md | 10 +++++++- mParticle-Iterable.podspec | 2 +- mParticle-iterable/mParticle_Iterable.h | 4 +++ 5 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 Package.swift diff --git a/Cartfile b/Cartfile index 5e07a4c..a70156c 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ -github "Iterable/swift-sdk" ~> 6.2.0 +github "Iterable/swift-sdk" ~> 6.4.0 github "mparticle/mparticle-apple-sdk" ~> 8.0 diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..475d1d1 --- /dev/null +++ b/Package.swift @@ -0,0 +1,34 @@ +// 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-Iterable", + platforms: [ .iOS(.v11) ], + products: [ + .library( + name: "mParticle-Iterable", + targets: ["mParticle-Iterable"]), + ], + dependencies: [ + .package(name: "mParticle-Apple-SDK", + url: "https://github.com/mParticle/mparticle-apple-sdk", + .upToNextMajor(from: "8.0.0")), + .package(name: "IterableSDK", + url: "https://github.com/Iterable/swift-sdk", + .upToNextMajor(from: "6.4.0")), + ], + targets: [ + .target( + name: "mParticle-Iterable", + dependencies: [ + .product(name: "mParticle-Apple-SDK", package: "mParticle-Apple-SDK"), + .product(name: "IterableSDK", package: "IterableSDK"), + ], + path: "mParticle-Iterable", + exclude: ["Info.plist"], + publicHeadersPath: "." + ), + ] +) diff --git a/README.md b/README.md index 3851ffb..37cce67 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This repository contains the [Iterable](https://iterable.com) integration for th ### 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 or Cartfile, or add using SPM: ``` pod 'mParticle-Iterable', '~> 8' @@ -18,6 +18,14 @@ This repository contains the [Iterable](https://iterable.com) integration for th Carthage Note: Due to Carthage limitations with the Iterable SDK project, make sure to use the `--use-xcframeworks --no-use-binaries` flags when running `carthage update`. + OR + + ``` + https://github.com/mparticle-integrations/mparticle-apple-integration-iterable + ``` + + Add as a standard SPM package. + 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: { Iterable }"` in your Xcode console > (This requires your mParticle log level to be at least Debug) diff --git a/mParticle-Iterable.podspec b/mParticle-Iterable.podspec index c41b3a9..dbfae63 100644 --- a/mParticle-Iterable.podspec +++ b/mParticle-Iterable.podspec @@ -14,5 +14,5 @@ Pod::Spec.new do |s| s.ios.deployment_target = "11.0" s.ios.source_files = 'mParticle-Iterable/*.{h,m,mm}' s.ios.dependency 'mParticle-Apple-SDK/mParticle', '~> 8.0' - s.ios.dependency 'Iterable-iOS-SDK', '~> 6.2' + s.ios.dependency 'Iterable-iOS-SDK', '~> 6.4' end diff --git a/mParticle-iterable/mParticle_Iterable.h b/mParticle-iterable/mParticle_Iterable.h index b951add..9062f63 100644 --- a/mParticle-iterable/mParticle_Iterable.h +++ b/mParticle-iterable/mParticle_Iterable.h @@ -8,4 +8,8 @@ FOUNDATION_EXPORT const unsigned char mParticle_IterableVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import +#if defined(__has_include) && __has_include() #import +#else +#import "MPKitIterable.h" +#endif \ No newline at end of file