realm/realm-swift
 Watch   
 Star   
 Fork   
17 hours ago
realm-swift

v10.50.0

Drop support for Xcode 14, as it can no longer be used to submit app to the app store. Xcode 15.1 is now the minimum supported version.

Known Issues

  • Accessing App.currentUser within an App.subscribe callback would lead to a deadlock.

Enhancements

  • Added SyncConfiguration.initialSubscriptions which describes the initial subscription configuration that was passed when constructing the SyncConfiguration. (#8548)
  • When connecting to multiple server apps, a unique encryption key is used for each of the metadata Realms rather than sharing one between them (Core #7552).
  • Improve perfomance of IN queries and chained OR equality queries for UUID/ObjectId types. (.Net #3566)
  • Added support for updating Atlas Device Sync's base url, in case the need to roam between servers (cloud and/or edge server). This API is private and can only be imported using @_spi(Private)
    @_spi(RealmSwiftExperimental) import RealmSwift
    
    try await app.updateBaseUrl(to: "https://services.cloud.mongodb.com")
    (#8486).
  • Enable building RealmSwift as a dynamic framework when installing via SPM, which lets us supply a privacy manifest. When RealmSwift is built as a static library you must supply your own manifest, as Xcode does not build static 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. Trying to directly depend on both will give the error "Swift package target 'Realm' is linked as a static library by 'App' and 'Realm', but cannot be built dynamically because there is a package product with the same name."
    • 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).
  • The transferredBytes and transferrableBytes fields on Progress have been deprecated in favor of progressEstimate which is a value between 0.0 and 1.0 indicating the estimated progress toward the upload/download transfer. (#8476)

Fixed

  • -[RLMUser allSessions] did not include sessions which were currently waiting for an access token despite including sessions in other non-active states. (Core #7300, since v10.0.0).
  • [RLMApp allUsers] included users which were logged out during the current run of the app, but not users which had previously been logged out. It now always includes all logged out users. (Core #7300, since v10.0.0).
  • Deleting the active user (via User.delete()) left the active user unset rather than selecting another logged-in user as the active user like logging out and removing users does. (Core #7300, since v10.23.0).
  • Fixed several issues around copying an encrypted Realm between platforms with different page sizes (such as between x86_64 and arm64 Apple platforms):
    • Fixed Assertion failed: new_size % (1ULL << m_page_shift) == 0 when opening an encrypted Realm less than 64Mb that was generated on a platform with a different page size than the current platform. (Core #7322, since v10.42.0)
    • Fixed a DecryptionFailed exception thrown when opening a small (<4k of data) Realm generated on a device with a page size of 4k if it was bundled and opened on a device with a larger page size (since the beginning).
    • Fixed an issue during a subsequent open of an encrypted Realm for some rare allocation patterns when the top ref was within ~50 bytes of the end of a page. This could manifest as a DecryptionFailed exception or as an assertion: encrypted_file_mapping.hpp:183: Assertion failed: local_ndx < m_page_state.size(). (Core #7319)
  • Schema initialization could hit an assertion failure if the sync client applied a downloaded changeset while the Realm file was in the process of being opened (#7041, since v10.15.0).
  • The reported download progress for flexible sync Realms was incorrect. It is now replaced by a progress estimate, which is derived by the server based on historical data and other heuristics. (#8476)

Compatibility

  • Realm Studio: 15.0.0 or later.
  • APIs are backwards compatible with all previous releases in the 10.x.y series.
  • Carthage release for Swift is built with Xcode 15.3.0.
  • CocoaPods: 1.10 or later.
  • Xcode: 15.1.0-15.3.0.

Internal

  • Upgraded realm-core from v14.5.2 to 14.6.2
2 days ago
realm-swift

v10.49.3

Enhancements

  • Enable building RealmSwift as a dynamic framework when installing via SPM, which lets us supply a privacy manifest. When RealmSwift is built as a static library you must supply your own manifest, as Xcode does not build static 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. Trying to directly depend on both will give the error "Swift package target 'Realm' is linked as a static library by 'App' and 'Realm', but cannot be built dynamically because there is a package product with the same name."
    • 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).

Compatibility

  • Realm Studio: 14.0.1 or later.
  • APIs are backwards compatible with all previous releases in the 10.x.y series.
  • Carthage release for Swift is built with Xcode 15.3.0.
  • CocoaPods: 1.10 or later.
  • Xcode: 14.2-15.3.0.
15 days ago
realm-swift

v10.49.2

Enhancements

Fixed

  • Fixed a crash that would occur when an http error 401 or 403 is returned upon opening a watch stream for a MongoDB collection. (#8519)
  • Fix an assertion failure "m_lock_info && m_lock_info->m_file.get_path() == m_filename" that appears to be related to opening a Realm while the file is in the process of being closed on another thread. (#8507)
  • Fixed diverging history due to a bug in the replication code when setting default null values (embedded objects included). (Core #7536)
  • Null pointer exception may be triggered when logging out and async commits callbacks not executed. (Core #7434)
  • AppConfiguration.baseUrl will now return the default value of the url when not set rather than nil. (#8512)
  • Added privacy manifest to Core's Swift package (Swift #8535)
  • Fixed crash when integrating removal of already removed dictionary key (Core #7488, since v10.0.0)

Compatibility

  • Realm Studio: 15.0.0 or later.
  • APIs are backwards compatible with all previous releases in the 10.x.y series.
  • Carthage release for Swift is built with Xcode 15.3.0.
  • CocoaPods: 1.10 or later.
  • Xcode: 14.2-15.3.0.

Internal

  • Upgraded realm-core from 14.4.1 to 14.5.2
2024-03-23 11:18:46
realm-swift

v10.49.1

Enhancements

  • Improve file compaction performance on arm64 platforms for encrypted files between 16kB and 4MB in size. (PR #7492).

Fixed

  • Opening a Realm with a cached user while offline would fail to retry some steps of the connection process and instead report a fatal error. (#7349, since v10.46.0)

Compatibility

  • Realm Studio: 14.0.1 or later.
  • APIs are backwards compatible with all previous releases in the 10.x.y series.
  • Carthage release for Swift is built with Xcode 15.3.0.
  • CocoaPods: 1.10 or later.
  • Xcode: 14.2-15.3.0.

Internal

  • Upgraded realm-core from v14.3.0 to 14.4.1
2024-03-23 01:54:37
realm-swift

v10.49.0

This version introduces a new Realm file format version (v24). Opening existing Realm files will automatically upgrade the files, making them unable to be opened by older versions. This upgrade process should typically be very fast unless you have large Sets of AnyRealmValue, String, or Data, which have to be rewritten.

A backup will automatically be created next to the Realm before performing the upgrade. Downgrading to older versions of Realm will attempt to automatically restore the backup, or it will be deleted after three months.

Enhancements

  • Storage of Decimal128 properties has been optimised similarly to Int properties so that the individual values will take up 0 bits (if all nulls), 32 bits, 64 bits or 128 bits depending on what is needed. (Core #6111)
  • Improve file compaction performance on arm64 platforms for encrypted files between 16kB and 4MB in size. (PR #7492).

Fixed

  • Sorting on binary Data was done by comparing bytes as signed char rather than unsigned char, resulting in very strange orders (since sorting on Data was enabled in v6.0.4)
  • Sorting on AnyRealmValue did not use a valid total ordering, and certain combinations of values could result in values not being sorted or potentially even crashes. The resolution for this will result in some previously-valid combinations of values of different types being sorted in different orders than previously (since the introduction of AnyRealmValue in 10.8.0).
  • RLMSet/MutableSet was inconsistent about if it considered a String and a Data containing the utf-8 encoded bytes of that String to be equivalent. They are now always considered distinct. (since the introduction of sets in v10.8.0).
  • Equality queries on a Mixed property with an index could sometimes return incorrect results if values of different types happened to have the same hash code. (Core 6407 since v10.8.0).
  • Creating more than 8388606 links pointing to a single object would crash. (Core #6577, since v5.0.0)
  • A Realm generated on a non-apple ARM 64 device and copied to another platform (and vice-versa) were non-portable due to a sorting order difference. This impacts strings or binaries that have their first difference at a non-ascii character. These items may not be found in a set, or in an indexed column if the strings had a long common prefix (> 200 characters). (Core #6670, since 2.0.0 for indexes, and since since the introduction of sets in v10.8.0)
  • Fix a spurious crash related to opening a Realm on background thread while the process was in the middle of exiting (Core #7420).
  • Opening a Realm with a cached user while offline would fail to retry some steps of the connection process and instead report a fatal error. (#7349, since v10.46.0)

Breaking Changes

  • Drop support for opening pre-v5.0.0 Realm files.

Compatibility

  • Realm Studio: 14.0.1 or later.
  • APIs are backwards compatible with all previous releases in the 10.x.y series.
  • Carthage release for Swift is built with Xcode 15.3.0.
  • CocoaPods: 1.10 or later.
  • Xcode: 14.2-15.3.0. Note that we will be dropping support for Xcode 14 when Apple begins requiring Xcode 15 for app store submissions on April 29.

Internal

  • Upgraded realm-core from 13.26.0 to 14.3.0
2024-03-16 04:12:21
realm-swift

v10.48.1

Fixed

  • The Realm.framework privacy manifest was missing NSPrivacyAccessedAPICategoryDiskSpace, but we check free disk space before attempting to automatically back up Realm files (since 10.46.0).

Compatibility

  • Realm Studio: 14.0.1 or later.
  • APIs are backwards compatible with all previous releases in the 10.x.y series.
  • Carthage release for Swift is built with Xcode 15.3.0.
  • CocoaPods: 1.10 or later.
  • Xcode: 14.2-15.3.0.
2024-03-08 05:21:27
realm-swift

v10.48.0

Enhancements

  • Lifted a limitation that would prevent declaring a model with only computed properties. (#8414)
  • Add Xcode 15.3 to the release package (PR #8502).

Fixed

  • Fix multiple arguments support via the REALM_EXTRA_BUILD_ARGUMENTS environment variable in build.sh. (PR #8413). Thanks, @hisaac!
  • Fix some of the new sendability warnings introduced in Xcode 15.3 (PR #8502).

Compatibility

  • Realm Studio: 14.0.1 or later.
  • APIs are backwards compatible with all previous releases in the 10.x.y series.
  • Carthage release for Swift is built with Xcode 15.3.0.
  • CocoaPods: 1.10 or later.
  • Xcode: 14.2-15.3.0.
2024-02-13 23:33:39
realm-swift

v10.47.0

Enhancements

  • Added initial support for geospatial queries on points. There is no new dedicated type to store Geospatial points, instead points should be stored as (GeoJson-shaped) embedded object, as the example below:
    public class Location: EmbeddedObject {
      @Persisted private var coordinates: List<Double>
      @Persisted private var type: String = "Point"
    
      public var latitude: Double { return coordinates[1] }
      public var longitude: Double { return coordinates[0] }
    
      convenience init(_ latitude: Double, _ longitude: Double) {
          self.init()
          // Longitude comes first in the coordinates array of a GeoJson document
          coordinates.append(objectsIn: [longitude, latitude])
      }
    }
    Geospatial queries (geoWithin) can only be executed on such a type of objects and will throw otherwise. The queries can be used to filter objects whose points lie within a certain area, using the following pre-established shapes (GeoBox, GeoPolygon, GeoCircle).
    class Person: Object {
      @Persisted var name: String
      @Persisted var location: Location? // GeoJson embedded object
    }
    
    let realm = realmWithTestPath()
    try realm.write {
      realm.add(PersonLocation(name: "Maria", location: Location(latitude: 55.6761, longitude: 12.5683)))
    }
    
    let shape = GeoBox(bottomLeft: (55.6281, 12.0826), topRight: (55.6762, 12.5684))!
    let locations = realm.objects(PersonLocation.self).where { $0.location.geoWithin(shape) })
    A filter or NSPredicate can be used as well to perform a Geospatial query.
    let shape = GeoPolygon(outerRing: [(-2, -2), (-2, 2), (2, 2), (2, -2), (-2, -2)], holes: [[(0, 0), (1, 1), (-1, 1), (0, 0)]])!
    let locations = realm.objects(PersonLocation.self).filter("location IN %@", shape)
    
    let locations = realm.objects(PersonLocation.self).filter(NSPredicate(format: "location IN %@", shape))

Compatibility

  • Realm Studio: 14.0.1 or later.
  • APIs are backwards compatible with all previous releases in the 10.x.y series.
  • Carthage release for Swift is built with Xcode 15.2.0.
  • CocoaPods: 1.10 or later.
  • Xcode: 14.2-15.2.0.

Internal

  • Migrated Release pipelines to Github Actions.
2024-01-24 10:51:02
realm-swift

v10.46.0

Enhancements

  • Add a privacy manifest to both frameworks.
  • Internal C++ symbols are no longer exported from Realm.framework when installing via CocoaPods, which reduces the size of the binary by ~5%, improves app startup time a little, and eliminates some warnings when linking the framework. This was already the case when using Carthage or a prebuilt framework (PR #8464).
  • The baseURL field of AppConfiguration can now be updated, rather than the value being persisted between runs of the application in the metadata storage. (Core #7201)
  • Allow in-memory synced Realms. This will allow setting an in-memory identifier on a flexible sync realm.

Fixed

  • @Persisted's Encodable implementation did not allow the encoder to customize the encoding of values, which broke things like JSONEncoder's dateEncodingStrategy (#8425).
  • Fix running Package.swift on Linux to support tools like Dependabot which need to build the package description but not the package itself (#8458, since v10.40.1).

Breaking Changes

  • The schemaVersion field of Realm.Configuration must now always be zero for synchronized Realms. Schema versions are currently not applicable to synchronized Realms and the field was previously not read.

Compatibility

  • Realm Studio: 14.0.1 or later.
  • APIs are backwards compatible with all previous releases in the 10.x.y series.
  • Carthage release for Swift is built with Xcode 15.2.0.
  • CocoaPods: 1.10 or later.
  • Xcode: 14.2-15.2.0.

Internal

  • Upgraded realm-core from 13.25.1 to 13.26.0
2024-01-09 12:35:25
realm-swift

v10.45.3

Enhancements

  • Update release packaging for Xcode 15.2. Prebuilt binaries for 14.1 and 15.0 have now been dropped from the release package.

Compatibility

  • Realm Studio: 14.0.1 or later.
  • APIs are backwards compatible with all previous releases in the 10.x.y series.
  • Carthage release for Swift is built with Xcode 15.2.0.
  • CocoaPods: 1.10 or later.
  • Xcode: 14.2-15.2.0.