RxSwiftCommunity / RxRealm

RxSwift extension for RealmSwift's types
MIT License
1.15k stars 265 forks source link

Realm Swift SDK v10.49.3 changed the details for installing the package with Swift Package Manager (SPM) #214

Open lluisgerard opened 5 months ago

lluisgerard commented 5 months ago

As explained on Realm documentation Swift Package Target Cannot be Built Dynamically, you now have to select either a Realm or RealmSwift library. For this project only RealmSwift should be selected.

At the moment, if you create a project from scratch and you just add RxRealm as a dependency you get this error:

Swift package target `Realm` is linked as a static library by `TargetName`
--
and `Realm`, but cannot be built dynamically because there is a package
product with the same name.

image

I uploaded more info in this comment on another thread in Realm github repo: https://github.com/realm/realm-swift/issues/8566#issuecomment-2093052502

I tried doing this myself but I cannot get the project to compile for some reason so I decided to report it here in the meantime.

If choosing only RealmSwift is not possible, in the meantime we could also limit the version to v10.49.2 (the one before they changed this).

lluisgerard commented 5 months ago

I forked the project and removed "Realm" library everywhere. It seems to work for me when pointing SPM to my work. I didn't add "Embed & Sign".

https://github.com/RxSwiftCommunity/RxRealm/compare/main...fieldmargin:RxRealm:main

HyenaJeremyLin commented 5 months ago

I encountered the same problem, is there any update?

freak4pc commented 5 months ago

As far as I know this project doesn't have an active maintainer. If someone has a PR I can try and help

lluisgerard commented 5 months ago

As far as I know this project doesn't have an active maintainer. If someone has a PR I can try and help

I added a PR that works for me in SPM where I removed any reference to "Realm" and kept "RealmSwift". https://github.com/RxSwiftCommunity/RxRealm/pull/215 I don't know how it affects Cocoapods or Carthage thought.

JoeMatt commented 4 months ago

As far as I know this project doesn't have an active maintainer. If someone has a PR I can try and help

I'm maintaining but I have some limited access to the repo and settings.

I merged what I could as best as I could.

I think I have access to public podpsecs, I need to refresh my memory.

Are we no longer using the Slack by the way?

JoeMatt commented 4 months ago

FYI, point to main branch for now and it should work.

JoeMatt commented 4 months ago

I'm having issues where I get past the linker error, but now it's saying missing symbols.

If I add back Realm into the SPM, I get that "static link" error again.

I'm trying to figure out if that's a local project issue or something I need to fix in the Package.swift

JoeMatt commented 4 months ago

I'm stuck in a loop in my own app. I've been testing my local checkout and doing all sort of things to the Package.swift.

I can either get it to not have that static issue, or it complains about missing symbols that are in the Realm, not RealmSwift, package.

In theory, these should be linked.

I tried making both dynamic and static versions and using both.

I'm at a lost. Realm Swift is such a PITA to work with.

I'm going to force an older version myself and if anyone has any ideas or fixes, please let me know and make a PR if you can.

image
lluisgerard commented 4 months ago

@JoeMatt can you try adding realm to your project as explained here as if RxRealm had no dependency? https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/install/#installation

Try doing step 5 (add to Frameworks and Libraries) with Embed & Sign). Let me know if that works for you. I even sent a build to TestFlight and passed review (I was testing our Privacy Manifest).

There might be a way to do this automatically as a dependency, I'll see if there's anyrhing I can do. If it's not possible I will update the README file to add this information.