Related: I binned off Core Data for Big Mail 2, and instead have been using the phenomenal GRDB by @groue

Not only is my app now faster and less buggy, but it’s so much easier to reason with. No weird managed contexts and elaborate dances to pass stuff between threads. Just simple, safe, Swift structs.

(Also, the documentation is INSANE) github.com/groue/GRDB.swift

There's also a sister package, GRDBQuery, which gives you a @Query property wrapper for SwiftUI (similar to @FetchRequest in Core Data)

You're then able to write views that automatically update when anything in the database changes.

Here's all the code needed for the account picker in Big Mail. So clean.

github.com/groue/GRDBQuery

Big Mail 2, nay, ALL my apps, wouldn't be possible if it weren't for the generous contributions of others in the OS community.

I can't wait to give back, so that's why I plan to open source all of Big Mail's core packages: SwiftIMAP, SwiftSMTP, and SwiftEmail.

They're all super Swifty, modern, and hopefully instantly familiar to anyone who's used Foundation.

Writing these packages has also been a fun exercise in how to design APIs now that we have concurrency.

For example, subscribing to IMAP idles (pushed events), I borrowed the 'updates' pattern used in the new StoreKit 2 API. It's an AsyncStream that just runs forever, and gets iterated over when new events occur.

This concludes this morning's stream of consciousness.

Tune in tomorrow!

@phill @mattiem This sounds great. I made my own Swift IMAP client but may switch to this as have not maintained it.

@phill it really makes me happy to see you’re structuring these as small packages. Maximum utility for the most users!

@phill are there some thoughts about gpg support directly in Big Mail? There is no propper comfortable solution for this.

@phill That would be so great, and as far as I know, a truly unique feature. It's something I've been missing on iOS for over a decade. I use iPG Mail since I got my first iPhone in addition. I asked the developer of it, if there was a way to create a plugin for the native Mail app a few years ago. He replied that it wouldn't be possible due to Apple's security restrictions. He also said that he didn't want to create a full Mail app.

@phill Really interested to see those when you release them. Mostly so I can code my own little status bar thing that checks for emails without leaving Thunderbird & Mail open.

@phill Hey, just in case:

“Did you know that you should manually ensure that your async for loops don't run infinitely? This is different from Combine where we must ensure that our subscriptions don't get cleaned up early.”

chaos.social/@donnywals/110344

@phill Based on some recent posts I wanted to give Big Mail another shot but I see now it’s no longer available and Big Mail 2 isn’t ready yet. Is there a test flight up?

@Alticus it’ll be back with a vengeance soon. Keep your eyes peeled here.

@phill my number 1 (and maybe only) wish for this WWDC is Apple to sherlock GRDB by bringing everything you described to Core Data (nothing personal @groue!). I enjoy using Core Data but it requires so much effort to get it right…

@alpennec @groue or heaven forbid Apple contributes! 😅

Plus why wait? A great alternative to Core Data already exists!

@phill @groue Do you use CloudKit sync and if yes, which wrapper class do you want to use?

@HOsy No CloudKit, have rolled own API with Vapor. Shared models/controllers between client is 👌

@phill @groue I think it is a good decision to move from CoreData to SQLite. Did the same.

@phill appreciate you shouting this out. Spent the day moving my app over to it, and it's fantastic

Sign in to participate in the conversation
The Not So Big Company

The home of The Not So Big Company on Mastodon.