-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support building via the Swift Package Manager #4555
Comments
Hi @flyingnoob thanks for your interest in Realm! We're tracking SwiftPM support as part of a larger task to take preliminary steps towards making a proof-of-concept demonstration of Realm Swift building on Linux. However, it might make sense for this task to be specifically tracked on its own, so I'll keep this ticket alive but will edit it to clarify exactly what this means. Don't hold your breath for SwiftPM support, however. Realm already officially supports at least 4-5 separate installation methods and each one requires a significant amount of infrastructure, testing and automation, so we're not exactly keen on adding another unless the gains are worth the investment. |
More so than Linux support, having SwiftPM support is useful for Swift Scripts on OSX. I am currently using a pre-populated Realm database on an iOS app. Generating the database through Tests or other hacks seems less ideal than having a swift script. However, I do understand the amount of work that would have to go into this, just thought I'd bring up more use cases. 😊 |
The Realm Swift framework can be used in Swift scripts as built by the different build options we currently support. It might be more convenient for you to do so via SwiftPM, but that shouldn't block you until then. |
My use case is similar to @hsienchiaolee. I have a project where we want to ditch CocoaPods in favor of SPM; linux support is not a concern. RealmSwift is the only dependency blocking that at the moment. |
👍 for SPM support |
👍 |
+1 My use case is similar: I want to use SPM for a set of modules that I'd REALLY like to ditch CocoaPods for. The use of RealmSwift in these modules is the only thing keeping me from doing that. Linux support is not a factor for me. |
👍 and thanks for the great work you guys do. |
👍 |
👍 +1 (so far I have found no way to build with |
👍 |
2 similar comments
👍 |
👍 |
👍 for SPM Well once Swift PM becomes the defacto standard, the community will probably leave cocoapods and carthage behind. It's possible that Xcode will let you add packages through a nice interface. The swift community needs to have an easy package manager, similar to Nugets on Visual Studio. |
👍 We need a proper way to resolve sub-dependencies and SPM does this nicely (compared to Carthage). |
Super tiny progress update. Now that swiftlang/swift-package-manager#1249 is available in a Swift snapshot, I'm able to build realm-core using SwiftPM and invoke it from Swift. That being said, don't get too excited about this just yet, this isn't being highly prioritized and is unlikely to see much active development from within Realm for some time. |
👍 |
1 similar comment
👍 |
@jpsim i'm wondering if you have any news? |
I don't. Perhaps someone still at Realm can comment. |
@jpsim oh i'm sorry, I didn't know that you had left the company |
@tgoyne i'm wondering if you have any news? |
I just create a PR for this: Hopefully will be approved |
Just watching WWDC 2019 sessions. Xcode 11 now supports SPM. Would like to drop CocoaPods as soon as possible. |
SPM still intentionally doesn’t support non-system binary libraries, so we have to find a way to hack around that and make it do things it’s designed not to do. |
Some good news on that front: https://twitter.com/daniel_dunbar/status/1137005810297401350 |
Seems like this can be closed as SwiftPM support has been added here: #6187, thanks @tgoyne 🎉 Would be great if https://realm.io/docs/swift/latest/ could be updated with SwiftPM integration instructions.
did the trick for me. ❤️ |
FWIW, I followed the guide below with (released) Xcode 11 and was able to add Realm 3.18 to my project and remove Carthage completely: Add both Realm and RealmSwift when prompted by Xcode. EDIT: This all appears to run fine from within Xcode, but so far neither Xcode Server nor Bitrise CI tools are able to run tests as they're both failing to build properly (for different reasons). EDIT 2: Xcode Server was getting double link targets from an Obj-C file in my project including the generated header. Removing the #include fixed that. Bitrise CI is still failing with some weirdness, so I'm disabling that. Overall, CI builds are now ~6 minutes longer than with Carthage, as it seems the Realm code is complied anew every time vs just linking in the pre-compiled framework. SPM isn't all 🌹 🌹 🌹 . EDIT 3: I had to replace the SPM Realm with the Carthage one and re-release, as some users had crashes when the SPM Realm tried to open their pre-existing Realm database. No idea what the root cause was, or even the pattern (though come to think of it, both customers who communicated with me were running iOS 10.3.x). Fortunately, switching back did fix the problem for them. |
Hey! xcodebuild command line tools use ssh protocol by default. But I see that realm-cocoa uses realm-core via https which causes problems in CI. Can it be fixed? Should I create a separate issue for it?
|
That is only applicable to private repositories. SPM doesn't support supplying a login to clone https-based URLs, but you don't need to log in to clone realm-core. |
In case when you consume all SPM dependencies via ssh, including I had to fork |
Is there SPM support for RealmSwift yet ? |
This support should be coming with Xcode 12 on the horizon... |
Are we there yet ? |
Building with SPM is supported, but we have yet to add support for Realm Sync via SPM. |
Release 10.5.0 brings support for MongoDB Realm (Sync) when using SPM. Thanks, team Realm! |
The Swift Package Manager supports building C, C++, Objective-C, Objective-C++ and Swift, so it should be possible to support building Realm Swift via SwiftPM. This is a requirement to being able to build Realm Swift on Linux (#3263).
The text was updated successfully, but these errors were encountered: