Realm-Cocoa V5.0.0 is released

Realm Cocoa V5.0.0 is out and ready for production deployment

NOTE: This version bumps the Realm file format to version 10. It is not possible to downgrade version 9 or earlier. Files created with older versions of Realm will be automatically upgraded. Only Studio 3.11 or later will be able to open the new file format.


  • Storing large binary blobs in Realm files no longer forces the file to be at least 8x the size of the largest blob.
  • Reduce the size of transaction logs stored inside the Realm file, reducing file size growth from large transactions.
  • Add support for frozen objects. Realm , Results , List and Object now have freeze() methods which return a frozen copy of the object. These objects behave similarly to creating unmanaged deep copies of the source objects. They can be read from any thread and do not update when writes are made to the Realm, but creating frozen objects does not actually copy data out of the Realm and so can be much faster and use less memory. Frozen objects cannot be mutated or observed for changes (as they never change). (PR #6427).
  • Add the isFrozen property to Realm , Results , List and Object .
  • Add Realm.Configuration.maxNumberOfActiveVersions . Each time a write transaction is performed, a new version is created inside the Realm, and then any versions which are no longer in use are cleaned up. If too many versions are kept alive while performing writes (either due to a background thread performing a long operation that doesn’t let the Realm on that thread refresh, or due to holding onto frozen versions for a long time) the Realm file will grow in size, potentially to the point where it is too large to be opened. Setting this configuration option will make write transactions which would cause the live version count to exceed the limit to instead fail.
  • Add support for queue-confined Realms. Rather than being bound to a specific thread, queue-confined Realms are bound to a serial dispatch queue and can be used within blocks dispatched to that queue regardless of what thread they happen to run on. In addition, change notifications will be delivered to that queue rather than the thread’s run loop. (PR #6478).
  • Add an option to deliver object and collection notifications to a specific serial queue rather than the current thread. (PR #6478).
  • Add Combine publishers for Realm types. Realm collections have a .publisher property which publishes the collection each time it changes, and a .changesetPublisher which publishes a RealmCollectionChange each time the collection changes. Corresponding publishers for Realm Objects can be obtained with the publisher() and changesetPublisher() global functions.
  • Extend Combine publishers which output Realm types with a .freeze() function which will make the publisher instead output frozen objects.
  • String primary keys no longer require a separate index, improving insertion and deletion performance without hurting lookup performance.
  • Reduce the encrypted page reclaimer’s impact on battery life when encryption is used. (Core #3461).


  • The uploaded bytes in sync progress notifications was sometimes incorrect and wouldn’t exactly equal the uploadable bytes when the uploaded completed.
  • macOS binaries were built with the incorrect deployment target (10.14 rather than 10.9), resulting in linker warnings. (#6299, since 3.18.0).
  • An internal datastructure for List properties could be double-deleted if the last reference was released from a thread other than the one which the List was created on at the wrong time. This would typically manifest as “pthread_mutex_destroy() failed”, but could also result in other kinds of crashes. (#6333).
  • Sorting on float or double properties containing NaN values had inconsistent results and would sometimes crash due to out-of-bounds memory accesses. (#6357).

Breaking Changes

  • The ObjectChange type in Swift is now generic and includes a reference to the object which changed. When using observe(on:) to receive notifications on a dispatch queue, the object will be confined to that queue.
  • The Realm instance passed in the callback to asyncOpen() is now confined to the callback queue passed to asyncOpen() rather than the thread which the callback happens to be called on. This means that the Realm instance may be stored and reused in further blocks dispatched to that queue, but the queue must now be a serial queue.
  • Files containing Date properties written by version of Realm prior to 1.0 can no longer be opened.
  • Files containing Any properties can no longer be opened. This property type was never documented and was deprecated in 1.0.
  • Deleting objects now preserves the order of objects reported by unsorted Results rather than performing a swap operation before the delete. Note that it is still not safe to assume that the order of objects in an unsorted Results is the order that the objects were created in.


  • File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
  • Realm Object Server: 3.21.0 or later.
  • Realm Studio: 3.11 or later.
  • APIs are backwards compatible with all previous releases in the 5.x.y series.
  • Carthage release for Swift is built with Xcode 11.4.1.

For more, please see -

As always, please let us know of any issues

The MongoDB Realm Team

1 Like