yapstudios / YapDatabase

YapDB is a collection/key/value store with a plugin architecture. It's built atop sqlite, for Swift & objective-c developers.
Other
3.35k stars 365 forks source link

Combine / SwiftUI? #522

Open mickeyl opened 4 years ago

mickeyl commented 4 years ago

After using Objective-C for 10 years, 5 of them with YapDatabase, I'm just starting to get into SwiftUI.

Did anyone of you find out a good way to bind YapDatabase as the "data source" (or whatever it's called these days in SwiftUI) for a SwiftUI (lazy) grid?

Or more generally speaking… is anyone using YapDatabase with Combine?

mickeyl commented 2 years ago

FWIW, for now I settled on using https://github.com/groue/GRDB.swift. I still miss YapDatabase's approach with the computed views, but while YapDatabase seems to be EOL, GRDB is Swift-native and embraces Combine and SwiftUI.

chrisballinger commented 2 years ago

Yep that's where I've landed as well, GRDB is great. Maybe you could build some Yap-like functionality on top of GRDB and release it as a Swift Package?

mickeyl commented 2 years ago

Indeed – I'm pretty sure this would be possible. I would have started already, but I'm just worried about Apple presenting their own Swift-native database solution soon… so lets wait at least until after WWDC2022…

robbiehanson commented 2 years ago

I still love the technology in YapDatabase - I miss having its Views almost everyday. But as mickeyl pointed out:

I'm just worried about Apple presenting their own Swift-native database solution

And that touches on the issue. Apple has their own database tech. And they keep improving it, and adapting it to work with their latest technologies. If you want to convince apple developers (like yourselves) to use non-apple-owned tech, then the 3rd-party tech has to be either:

I spent a lot of time thinking about this. And I learned a lot by watching Realm. So... Realm was multiplatform - and this was a big part of their success. Realm also had a lot of money. They spent a lot of money on marketing, and it was a very successful marketing campaign (from my perspective as a competing database). In contrast, YapDatabase was not multiplatform, and had zero money.

But all that VC money meant that Realm still had to create some kind of business. So they added cloud syncing, with their own cloud backend. And this, to me, was the most interesting. You might recall that I added YapDatabaseCloudCore, which was the foundation for pluggable syncing. I spent a lot of time thinking about how YapDatabse could connect to various clouds. And what niche ecosystems exist for these technologies. I even tried to create a business around encrypted zero-knowledge sync technology - but failed.

If I was to rewrite YapDatabase from scratch today, I don't know if I would choose Swift. Perhaps Kotlin-Multiplatform would be a better way to go. With a Swift-native layer on top. Similar to what Realm did.