-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
RCOCOA-2343 Enable building RealmSwift as a dynamic framework with SPM #8561
Conversation
078c443
to
790366e
Compare
This appears to work but the process for validating app privacy manifests is so awful that it's hard to be sure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!, Just a few minor comments
- To actually build RealmSwift as a dynamic framework, change "Do Not Embed" | ||
to "Embed & Sign" in the "Frameworks, Libraries, and Embedded Content" | ||
section on the General tab of your target's settings. | ||
([#8561](https://github.com/realm/realm-swift/pull/8561)). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we tag the docs teams for this to be added to this page? https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/install/
libraries in a way compatible with xcprivacy embedding. Due to some bugs in | ||
Xcode, this may require manual changes to your project: | ||
- Targets must now depend on only Realm or RealmSwift. If you use both the | ||
obj-c and swift API, depending on RealmSwift will let you import Realm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means, that by importing RealmSwift, user will have access to Realm API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, Realm is still a separate import. They just don't have to add it as a dependency in the project.
This is required for compliance with the new privacy manifest rules. While App Store Connect supports static libraries, Xcode doesn't actually build static libraries for static targets; it just links the object files directly into the app. It also doesn't implement the xcprivacy manifest merging that the documentation claims exists, so our privacy manfiest is never actually used.
790366e
to
2ca5c82
Compare
While App Store Connect supports static libraries, Xcode doesn't actually build static libraries for static targets; it just links the object files directly into the app. It also doesn't implement the xcprivacy manifest merging that the documentation claims exists, so the only way to actually use our privacy manifest is to build a dynamic framework.
Because Xcode is very weird, setting the library type to
.dynamic
doesn't actually result in it being built as a dynamic framework; it just gives the consuming app the option of building it as dynamic. It also makes it so that having multiple targets depend on the product is broken. Hopefully that will not be a problem.Building Realm.framework as dynamic and then RealmSwift.framework as static doesn't work, so this adds the privacy manifest to RealmSwift.framework as well.