mixpanel / mixpanel-swift

Official iOS (Swift) Tracking Library for Mixpanel Analytics
https://mixpanel.com
Apache License 2.0
434 stars 234 forks source link

Support add Mixpanel to a Package.swift manifest #459

Closed kiroskirin closed 3 years ago

kiroskirin commented 3 years ago

When I try to add Mixpanel to Package.swift manifest

I got the error

.../.build/checkouts/mixpanel-swift/Sources/ApplicationStateSerializer.swift:10:8: error: no such module 'UIKit'
import UIKit

Which I understand that the framework still not support.

So it will be awesome to make it like Firebase did.

Thank you very much.

zihejia commented 3 years ago

hi @kiroskirin , are you using it in macOS? We do have support in the 3.0.0.beta branch. Just point to the branch 3.0.0.beta. macOS support is only available in the 3.x going forward. I'm closing this issue for now. Please feel free to reopen if you have any other issues.

hisavali commented 3 weeks ago

I have a Package.swift with following

// swift-tools-version: 5.7.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "mypackage",
    platforms: [.iOS(.v15), .macOS(.v10_15)],
    products: [
        .library(
            name: "AnalyticsClientLive",
            targets: ["AnalyticsClientLive"]
            )
    ],
    dependencies: [
        .package(url: "https://github.com/mixpanel/mixpanel-swift", from: "2.8.0")
    ],
    targets: [
        .target(
            name: "AnalyticsClientLive",
            dependencies: [
                "AnalyticsClient",
                .product(name: "Mixpanel", package: "mixpanel-swift")
            ]
    )]
)

On CI machine (hosted on with macOS-13 macOS-14 configuration) and fails with error

/Users/runner/work/1/s/.build/checkouts/mixpanel-swift/Sources/ApplicationStateSerializer.swift:10:8: error: no such module 'UIKit'
import UIKit

I compared Package.swift in branch 3.0.0.beta against master. Difference is in platforms:[] being supported.

Can someone assist on how to resolve it? Cheers.

hisavali commented 3 weeks ago

@zihejia Please let me know if you have any input to my last query. Cheers.

jaredmixpanel commented 2 weeks ago

@hisavali please update to the latest version of mixpanel-swift which is v4.3.0