Closed seank90 closed 1 year ago
Thanks for supporting Amplitude!
@seank90 , could you elaborate how you "Add Amplitude"? We have these package managers supported: https://www.docs.developers.amplitude.com/data/sdks/sdk-quickstart/#install-the-dependency_4.
Hi @liuyang1520
This is how we added it with Swift Package
let package = Package(
name: "mobile-sdk-ios",
platforms: [
.iOS(.v13)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "mobile-sdk-ios",
type: .dynamic,
targets: ["mobile-sdk-ios"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/amplitude/Amplitude-Swift", from: "0.3.0"),
.package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.1.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "mobile-sdk-ios",
dependencies: [
"multiplatform-mobile",
"Amplitude-Swift",
.product(name: "Sentry", package: "sentry-cocoa")
],
resources: [
.copy("Resources/Lato-Regular.ttf"),
.copy("Resources/Lato-Bold.ttf")
]
),
.testTarget(
name: "mobile-sdk-iosTests",
dependencies: ["mobile-sdk-ios"]),
.binaryTarget(name: "multiplatform-mobile",
path: "../multiplatform-mobile-sdk/build/swiftpackage/multiplatform-mobile.xcframework")
],
swiftLanguageVersions: [.v5]
)
When we build and inspect the archive we get this as a result.
As you can see we don't have Amplitude included. Which is an issue.
Thanks @seank90 !
I just search online about the XCFramework, here are some findings:
To follow up:
.product(name: "Sentry", package: "sentry-cocoa")
, is it possible to put Amplitude-Swift
package there?Hi @liuyang1520
Thank you for sending over the links, I'll check it out.
The issue we are facing is that we are looking to have a closed source swift package. The way we can do this is by having an XCFramework within a Swift package and setting it as a binary dependancy, this way the code is secure.
But when we try and bundle Amplitude in this framework it doesn't seem to create a .framework file from where it can be referenced.
We were using Sentry for Crash Reporting 😄
Hi @seank90, would like to check in and see if this issue has been solved.
Closing this as it seems to be solved.
Expected Behavior
We are trying to include Amplitude iOS as part of our package.
Current Behavior
It's not getting added when we compile the XCFramework file and is read as a missing dependency.
Steps to Reproduce
Environment