skiptools / skip

Skip transpiler for creating SwiftUI apps for iOS and Android
https://skip.tools
GNU Lesser General Public License v3.0
1.58k stars 42 forks source link

Request: RealmSwift demo #105

Open aehlke opened 8 months ago

aehlke commented 8 months ago

I have a lot of real swift code with modern async and their new statically typed query expressions. I'm not sure how I'd port this to android which also has a very similar realm client.

X901 commented 8 months ago

I'm like you I'm waiting for Realm suppourt when you check the libraries support they're support Sql and Firebase only for now

Screenshot 2024-04-01 at 3 10 14 PM
marcprux commented 8 months ago

I'm taking a look at the Realm SDK now to assess the feasibility of getting it working with Skip. FTR, the Firebase APIs were pretty simple because the Swift and Kotlin SDKs are almost identical, so we really just needed to write some boilerplate bridging code on the Kotlin side (and we left the Swift side untouched). The https://github.com/realm/realm-swift and https://github.com/realm/realm-kotlin SDKs seem to be a bit more divergent, but we might be able to hammer something into place (or you can take a run at it, using the https://github.com/skiptools/skip-firebase repo as a template).

Another consideration is that https://realm.io shows a headline message "Realm is now Atlas Device SDK", which makes me wonder about the future of the Realm APIs. Does anyone have insight into whether the current SDKs are going to be deprecated?

aehlke commented 8 months ago

They're not deprecating the Realm clients, it's just a branding change: when the MongoDB company bought them, they added a MongoDB-backed server sync service ("Atlas"), and they've now subsumed Realm into its branding. It's still under active development. I think many people used Realm without paying for their pre-MongoDB sync service, so the branding change is a push to get people to adopt the paid part.

The server sync portion remains entirely optional as well. I don't use it at all and don't pay for Realm. I use an open source tool for syncing Realm with iCloud instead (very similar to how SwiftData works), and would need to figure out something for Android.

Btw if you want to start with partial surface area coverage, IDK about realm-kotlin but realm-swift has a few different styles of using it that are more or less problematic/modern. The ideal is probably to start with the async API and actor-bound Realms, which is the most modern and most stable way of using Realm. The SwiftUI conveniences are less necessary (ObservedResults is also crashy, ObservedRealmObject is fine). Synchronous Realm access can also still be important.

Both clients use the same realm core underneath, but they can have a lot of platform-specific logic on top...

SwiftData for Android would also be cool and a possibility to migrate to vs. Realm, but might be a lot more work since there's nothing close to it already except SQLite itself