Closed arthurschiller closed 1 year ago
Skipping Swift Package Manager with an SDK of this size and reach is a bit silly. Is there a technical reason why? There's also some extremely outdated practices in the examples.
Such a great piece of technology, but the SDK's developer experience needs some TLC.
ARCore 1.33 has beta support for SPM - you can download the pod bundle (here for 1.33), unzip it and use it as a local Swift Package. Follow the instructions in the bundled README file.
Amazing @jrullman! 🙏 Thanks a lot, will check it out!
Hi @jrullman,
quick update: so far I wasn't able to get this working. I also created a barebones super simple project with the following steps:
It always shows me a linker error, telling my bitcode is missing. If I disable bitcode for the target I get even more errors. Screenshots attached. Tested with both Xcode 13 and 14, minimum deployment target iOS 15.4. Anything obvious I might be missing?
Thanks a lot!
1) About bitcode, as mentioned in the CHANGELOG for 1.33 we have removed bitcode from our binaries, as Apple has deprecated it. As of Xcode 14, it will no longer be enabled by default, but for Xcode 13 you would have to disable it manually on your project. (The CocoaPod disables it for you, but unfortunately SPM doesn't provide a way to manipulate the project settings like this.)
2) For the linker errors, it's not linking libc++ or a bunch of other Apple SDK frameworks. We could add these in Package.swift using .linkedFramework()
and .linkedLibrary()
, but with the frameworks there is the issue of weak linking - it seems to always strongly link the frameworks. Instead we are relying on the magic of auto-linking, where Xcode figures out which libraries and frameworks to link (and whether to use strong or weak linking) based on #import
/@import
statements and modulemap files. To get this to work you just need to:
a) #import
or @import
ARCore somewhere in your code (you probably didn't do this yet).
b) Make sure the Build Settings "Enable Modules" and "Link Frameworks Automatically" are set to "Yes".
I know it's strange for something to build only after adding an import statement; we need to document this better.
(Quick note: you don't need to add dependencies on "GARSession" and "Base", as these are just shared dependencies for other components, but it doesn't hurt anything either.)
Ahh okay 2. did the trick but I think this definitely needs to be documented better. My projects are Swift only and to get this working I had to create an Objective-C bridging header where I added the @import ARCore;
statement.
As I suppose most new projects nowadays would be Swift exclusive I think that's a crucial step for the documentation.
Thanks for the help and hints @jrullman!
Nevermind, so it all builds fine but at runtime I get the following exception:
Did you get it to run in a Swift-only project? The previous version 1.32.0 ran fine via CocoaPods.
The unrecognized selector issue happens when you don't have the linker flag "-ObjC", which prevents the linker from throwing away Objective-C categories.
For the import statement, I believe it can just be a regular import
statement in Swift, which is equivalent to @import
in Objective-C.
Thanks, it's working now. Forgot the linker flag this time. Appreciate the patience!
Hi @jrullman Can you please tell me how to download the pod bundle? I am looking for pod bundles for versions other than 1.33 (e.g. 1.34), but I don't know how to get them on my own.
Hi @jrullman Can you please tell me how to download the pod bundle? I am looking for pod bundles for versions other than 1.33 (e.g. 1.34), but I don't know how to get them on my own.
Hi, you can find the download link in the podspec: https://github.com/CocoaPods/Specs/blob/master/Specs/4/e/a/ARCore/1.34.0/ARCore.podspec.json
Podspec can be retrieved here: https://cocoapods.org/pods/ARCore (Right sidebar – »See Podspec«)
Hi! I'm also interested in full SPM support. Hopefully it's still on the radar :)
Stay tuned ;)
Starting from release 1.36.0, Swift Package Manager is officially supported. Please see the README for installation instructions.
Hello,
are there any plans to distribute this project via Swift Package Manager? Specifically I want to utilise the GeoSpatial API within an existing ARKit-based app that already migrated away from CocoaPods over a year ago. We are also using Firebase via Swift Package Manger and as ARCore via CocoaPods lists Firebase as a dependency it would effectively build Firebase twice. Would greatly appreciate a reply.
Best regards Arthur