PostHog / posthog-ios

PostHog iOS SDK
https://posthog.com/docs/libraries/ios
MIT License
32 stars 41 forks source link

Package.swift file #1

Closed joshkopecek closed 3 years ago

joshkopecek commented 4 years ago

It would be great to have a Package.swift file for PostHog, so it could be easily installed.

mariusandra commented 4 years ago

Hi, is it also allowed to add Package.swift files to purely objective-c codebases? I don't have any experience with this, however I'd be more than happy to accept a PR that adds this file!

joshkopecek commented 4 years ago

I tried adding the Package.swift file, but there are some issues. It doesn't like the mixed swift/objc in the Tests, and I can't seem to add the UIKit framework as a dependency in objc.

I created a fork here: https://github.com/joshkopecek/posthog-ios/tree/features/spm

mariusandra commented 4 years ago

Hi @joshkopecek , just checking in, did you get posthog-ios working with a Package.swift file in the end... or how are you currently integrating it into your app? We'd love to make setup really easy for all iOS developers. We should probably update the docs to guide swift users better with the current way of installing it...

joshkopecek commented 4 years ago

Currently using Cocoapods to install, although Package.swift would be preferred. I did some rudimentary work on it, and looked like it would be possible, but I ran out of time. It's in my repo as mentioned above.

As I mentioned above I was struggling to get it to see the core iOS UIKit framework. It might be good to remove that anyway.

dannyhertz commented 4 years ago

Any progress on this? Had a call with the team today and SPM support would really make integration simpler for us. As for the UIKit import and can simply wrap anything that uses UIKit in conditional checks a la https://www.hackingwithswift.com/example-code/language/how-to-check-whether-a-module-is-available-using-canimport

mariusandra commented 4 years ago

I'd love it if someone with enough experience with ObjC/Swift dependencies could pick this up!

mariusandra commented 3 years ago

PR #10 and version 1.2.2 could have fixed this.