nextcloud / nextcloud/desktop

Replace Realm

Open
#9,046 1 comment 0 reactions 1 assignee Claimed by @i2h3 View on GitHub
feature: :file_folder: file provider
Dominant language
C++
Stars
3.9k
Forks
1k
Avg merge
1d 21h
Merged PRs (30d)
127

Description

## Problem

Our file provider extension uses Realm as its persistence technology. Realm is **deprecated as of September 2024**. Further, MongoDB has defined the **end-of-life** for associated Atlas Device SDKs in September 2025. It is not maintained actively any longer.

## Suggestion

- Use [GRDB](https://github.com/groue/GRDB.swift) to efficiently store many records.
- Have a database actor which abstracts the GRDB interaction and uses immutable, sendable value types for input and output.
- Personally, I have experience with CoreData in this use case with the given requirements. Putting the whole CoreData into an `actor` which strictly isolates it and only hands out `Sendable` value types avoids most of the concurrency issues one usually encounters with CoreData and is efficient.

## Discarded Options

- **CoreData** [is overkill](https://fatbobman.com/en/posts/why-i-am-still-thinking-about-core-data-in-2026/). A file provider extension needs an efficient and simple spreadsheet, not a whole object graph.
- **SwiftData** is built on top of CoreData. Previously, the earliest supported version of macOS 14 Sonoma alone was the show stopper. Then our minimum deployment target switched to macOS 13 Ventura. Then came the discovery of #9927 for which we cannot offer the file provider on macOS 13 Ventura in general, only macOS 14 Sonoma and newer. Still, it remains overkill as well.

Previous arguments for them:

- There barely is a reason to deviate from the first-party offering which likely will not be dropped so soon.
- Technologies like CoreData are very common in the Apple developer community and potential contributors may consider it more accessible.
- This will reduce build time and app size by removing a third-party dependency.

## References

* [GRDB](https://github.com/groue/GRDB.swift) - especially [Why adopt GRDB?](https://github.com/groue/GRDB.swift/blob/master/Documentation/WhyAdoptGRDB.md)
* [CoreData](https://developer.apple.com/documentation/coredata)
* [SwiftData](https://developer.apple.com/documentation/swiftdata)
* [Realm GitHub Repository](https://github.com/realm/realm-swift)
* [Atlas Device SDKs Deprecation](https://www.mongodb.com/docs/atlas/device-sdks/deprecation/)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.