Skip to content

Commit abbe849

Browse files
committed
Allow Realm to be built as a dynamic library when installing via SPM
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.
1 parent a4d7310 commit abbe849

File tree

8 files changed

+55
-39
lines changed

8 files changed

+55
-39
lines changed

CHANGELOG.md

+29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
10.49.3 Release notes (2024-04-30)
2+
=============================================================
3+
4+
### Enhancements
5+
6+
* Enable building RealmSwift as a dynamic framework when installing via SPM, which
7+
lets us supply a privacy manifest. When RealmSwift is built as a static
8+
library you must supply your own manifest, as Xcode does not build static
9+
libraries in a way compatible with xcprivacy embedding. Due to some bugs in
10+
Xcode, this may require manual changes to your project:
11+
- Targets must now depend on only Realm or RealmSwift. If you use both the
12+
obj-c and swift API, depending on RealmSwift will let you import Realm.
13+
Trying to directly depend on both will give the error "Swift package
14+
target 'Realm' is linked as a static library by 'App' and 'Realm', but
15+
cannot be built dynamically because there is a package product with the
16+
same name."
17+
- To actually build RealmSwift as a dynamic framework, change "Do Not Embed"
18+
to "Embed & Sign" in the "Frameworks, Libraries, and Embedded Content"
19+
section on the General tab of your target's settings.
20+
([#8561](https://github.com/realm/realm-swift/pull/8561)).
21+
22+
### Compatibility
23+
24+
* Realm Studio: 14.0.1 or later.
25+
* APIs are backwards compatible with all previous releases in the 10.x.y series.
26+
* Carthage release for Swift is built with Xcode 15.3.0.
27+
* CocoaPods: 1.10 or later.
28+
* Xcode: 14.2-15.3.0.
29+
130
10.49.2 Release notes (2024-04-17)
231
=============================================================
332

Package.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import PackageDescription
44
import Foundation
55

66
let coreVersion = Version("14.5.2")
7-
let cocoaVersion = Version("10.49.2")
7+
let cocoaVersion = Version("10.49.3")
88

99
let cxxSettings: [CXXSetting] = [
1010
.headerSearchPath("."),
@@ -147,10 +147,12 @@ let package = Package(
147147
products: [
148148
.library(
149149
name: "Realm",
150+
type: .dynamic,
150151
targets: ["Realm"]),
151152
.library(
152153
name: "RealmSwift",
153-
targets: ["Realm", "RealmSwift"]),
154+
type: .dynamic,
155+
targets: ["RealmSwift"]),
154156
],
155157
dependencies: [
156158
.package(url: "https://github.com/realm/realm-core.git", exact: coreVersion)

Realm/NSError+RLMSync.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//
1717
////////////////////////////////////////////////////////////////////////////
1818

19-
#import "NSError+RLMSync.h"
19+
#import <Realm/NSError+RLMSync.h>
2020

2121
#import "RLMError.h"
2222

Realm/Realm-Info.plist

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<key>CFBundlePackageType</key>
1818
<string>FMWK</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>10.49.2</string>
20+
<string>10.49.3</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>10.49.2</string>
24+
<string>10.49.3</string>
2525
<key>NSHumanReadableCopyright</key>
2626
<string>Copyright © 2014-2021 Realm. All rights reserved.</string>
2727
<key>NSPrincipalClass</key>

RealmSwift/PrivacyInfo.xcprivacy

+18-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,24 @@
77
<key>NSPrivacyCollectedDataTypes</key>
88
<array/>
99
<key>NSPrivacyAccessedAPITypes</key>
10-
<array/>
10+
<array>
11+
<dict>
12+
<key>NSPrivacyAccessedAPITypeReasons</key>
13+
<array>
14+
<string>C617.1</string>
15+
</array>
16+
<key>NSPrivacyAccessedAPIType</key>
17+
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
18+
</dict>
19+
<dict>
20+
<key>NSPrivacyAccessedAPITypeReasons</key>
21+
<array>
22+
<string>E174.1</string>
23+
</array>
24+
<key>NSPrivacyAccessedAPIType</key>
25+
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
26+
</dict>
27+
</array>
1128
<key>NSPrivacyTracking</key>
1229
<false/>
1330
</dict>

dependencies.list

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
VERSION=10.49.2
1+
VERSION=10.49.3
22
REALM_CORE_VERSION=v14.5.2
33
STITCH_VERSION=8bf8ebcff6e804586c30a6ccbadb060753071a42

examples/installation/SwiftPackageManager.notxcodeproj/project.pbxproj

-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
3FEC916A2A4D3B140044BFF5 /* SwiftExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */; };
1111
3FEC916E2A4D3B150044BFF5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */; };
1212
3FEC91722A4D3B150044BFF5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */; };
13-
3FEC917A2A4D3DB90044BFF5 /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = 3FEC91792A4D3DB90044BFF5 /* Realm */; };
1413
3FEC917C2A4D3DB90044BFF5 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3FEC917B2A4D3DB90044BFF5 /* RealmSwift */; };
1514
/* End PBXBuildFile section */
1615

@@ -27,7 +26,6 @@
2726
isa = PBXFrameworksBuildPhase;
2827
buildActionMask = 2147483647;
2928
files = (
30-
3FEC917A2A4D3DB90044BFF5 /* Realm in Frameworks */,
3129
3FEC917C2A4D3DB90044BFF5 /* RealmSwift in Frameworks */,
3230
);
3331
runOnlyForDeploymentPostprocessing = 0;
@@ -87,7 +85,6 @@
8785
);
8886
name = App;
8987
packageProductDependencies = (
90-
3FEC91792A4D3DB90044BFF5 /* Realm */,
9188
3FEC917B2A4D3DB90044BFF5 /* RealmSwift */,
9289
);
9390
productName = SwiftPM;
@@ -383,11 +380,6 @@
383380
/* End XCRemoteSwiftPackageReference section */
384381

385382
/* Begin XCSwiftPackageProductDependency section */
386-
3FEC91792A4D3DB90044BFF5 /* Realm */ = {
387-
isa = XCSwiftPackageProductDependency;
388-
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
389-
productName = Realm;
390-
};
391383
3FEC917B2A4D3DB90044BFF5 /* RealmSwift */ = {
392384
isa = XCSwiftPackageProductDependency;
393385
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;

examples/installation/SwiftPackageManagerDynamic.notxcodeproj/project.pbxproj

-24
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@
1010
3FEC916A2A4D3B140044BFF5 /* SwiftExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */; };
1111
3FEC916E2A4D3B150044BFF5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */; };
1212
3FEC91722A4D3B150044BFF5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */; };
13-
3FEC917A2A4D3DB90044BFF5 /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = 3FEC91792A4D3DB90044BFF5 /* Realm */; };
1413
3FEC917C2A4D3DB90044BFF5 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3FEC917B2A4D3DB90044BFF5 /* RealmSwift */; };
1514
3FF673252A684E4400500A25 /* Framework1.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FF6731F2A684E4400500A25 /* Framework1.framework */; };
1615
3FF673262A684E4400500A25 /* Framework1.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3FF6731F2A684E4400500A25 /* Framework1.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1716
3FF673362A684E4E00500A25 /* Framework2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FF673302A684E4E00500A25 /* Framework2.framework */; };
1817
3FF673372A684E4E00500A25 /* Framework2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3FF673302A684E4E00500A25 /* Framework2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
19-
3FF6733D2A684E7200500A25 /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = 3FF6733C2A684E7200500A25 /* Realm */; };
2018
3FF6733F2A684E7200500A25 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3FF6733E2A684E7200500A25 /* RealmSwift */; };
21-
3FF673412A684E7700500A25 /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = 3FF673402A684E7700500A25 /* Realm */; };
2219
3FF673432A684E7700500A25 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3FF673422A684E7700500A25 /* RealmSwift */; };
2320
/* End PBXBuildFile section */
2421

@@ -71,7 +68,6 @@
7168
files = (
7269
3FF673252A684E4400500A25 /* Framework1.framework in Frameworks */,
7370
3FF673362A684E4E00500A25 /* Framework2.framework in Frameworks */,
74-
3FEC917A2A4D3DB90044BFF5 /* Realm in Frameworks */,
7571
3FEC917C2A4D3DB90044BFF5 /* RealmSwift in Frameworks */,
7672
);
7773
runOnlyForDeploymentPostprocessing = 0;
@@ -80,7 +76,6 @@
8076
isa = PBXFrameworksBuildPhase;
8177
buildActionMask = 2147483647;
8278
files = (
83-
3FF6733D2A684E7200500A25 /* Realm in Frameworks */,
8479
3FF6733F2A684E7200500A25 /* RealmSwift in Frameworks */,
8580
);
8681
runOnlyForDeploymentPostprocessing = 0;
@@ -89,7 +84,6 @@
8984
isa = PBXFrameworksBuildPhase;
9085
buildActionMask = 2147483647;
9186
files = (
92-
3FF673412A684E7700500A25 /* Realm in Frameworks */,
9387
3FF673432A684E7700500A25 /* RealmSwift in Frameworks */,
9488
);
9589
runOnlyForDeploymentPostprocessing = 0;
@@ -179,7 +173,6 @@
179173
);
180174
name = App;
181175
packageProductDependencies = (
182-
3FEC91792A4D3DB90044BFF5 /* Realm */,
183176
3FEC917B2A4D3DB90044BFF5 /* RealmSwift */,
184177
);
185178
productName = SwiftPM;
@@ -201,7 +194,6 @@
201194
);
202195
name = Framework1;
203196
packageProductDependencies = (
204-
3FF6733C2A684E7200500A25 /* Realm */,
205197
3FF6733E2A684E7200500A25 /* RealmSwift */,
206198
);
207199
productName = Framework1;
@@ -223,7 +215,6 @@
223215
);
224216
name = Framework2;
225217
packageProductDependencies = (
226-
3FF673402A684E7700500A25 /* Realm */,
227218
3FF673422A684E7700500A25 /* RealmSwift */,
228219
);
229220
productName = Framework2;
@@ -743,31 +734,16 @@
743734
/* End XCRemoteSwiftPackageReference section */
744735

745736
/* Begin XCSwiftPackageProductDependency section */
746-
3FEC91792A4D3DB90044BFF5 /* Realm */ = {
747-
isa = XCSwiftPackageProductDependency;
748-
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
749-
productName = Realm;
750-
};
751737
3FEC917B2A4D3DB90044BFF5 /* RealmSwift */ = {
752738
isa = XCSwiftPackageProductDependency;
753739
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
754740
productName = RealmSwift;
755741
};
756-
3FF6733C2A684E7200500A25 /* Realm */ = {
757-
isa = XCSwiftPackageProductDependency;
758-
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
759-
productName = Realm;
760-
};
761742
3FF6733E2A684E7200500A25 /* RealmSwift */ = {
762743
isa = XCSwiftPackageProductDependency;
763744
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
764745
productName = RealmSwift;
765746
};
766-
3FF673402A684E7700500A25 /* Realm */ = {
767-
isa = XCSwiftPackageProductDependency;
768-
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
769-
productName = Realm;
770-
};
771747
3FF673422A684E7700500A25 /* RealmSwift */ = {
772748
isa = XCSwiftPackageProductDependency;
773749
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;

0 commit comments

Comments
 (0)