Boutique 3.0 Beta 1: An Observable Girl, Living In An Observable World #72
Replies: 2 comments 2 replies
-
Love it! Giving The main use case I'm having trouble fitting into the current API is around document storage. (Maybe I should be using Bodega directly?) |
Beta Was this translation helpful? Give feedback.
-
One bug I'm encountering is that my app appears to be reading stale cache data on app launch (in the simulator at least). Entries I've explicitly deleted such as via |
Beta Was this translation helpful? Give feedback.
-
Boutique 3.0 is the biggest update to Boutique since the release of Boutique 2.0, just over two years ago. Boutique 3.0 isn't a complete rewrite — I love how Boutique works and the last thing I want to do is change everything about it. But I want to continue advancing what Boutique can do, so Boutique has been modernized with rewritten internals to make it even better, simpler, and more flexible.
I want to emphasize, the Boutique you know and love is not changing — it's being extended to become even better, and here's how.
Goodbye
ObservableObject
, hello@Observable
. You can now use Boutique'sStore
,@StoredValue
, and@SecurelyStoredValue
with@Observable
. This makes your code cleaner, faster, and simpler to reason about. Boutique 3.0 is even easier to integrate into an app, without any additional concepts to learn.Swift 6 support. Swift 6 is a big change, and you can continue using Boutique in Swift 5 projects — no rush to upgrade. The Swift 6 data race safety upgrades have helped me track down some rare race conditions that may have occurred. Boutique's
Store
,@StoredValue
, and@SecurelyStoredValue
are now bound to @mainactor, to prevent loss or inconsistency of data.New APIs, for now and later. By cleaning up Boutique's internals, I've laid the groundwork for new features that will help Boutique match all that SwiftData has to offer. It's always been a goal for Boutique to be perfect out of the box for 95% of projects, but my goal now is to get Boutique to 99% — making it a fit for almost every project.
Here is a list of important high level changes, eschewing details buried in the code.
Store
&@Stored
AsyncStream
. This makes observing the Store's items cleaner, and you can now observe changes throughonChange
rather thanonReceive
.events
property publishesStoreEvent
values, allowing you to observe individual changes when aStore
isinitialized
,loaded
, and wheninsert
andremove
operations occur.@StoredValue
&@SecurelyStoredValue
Store
,StoredValue
, orSecurelyStoredValue
inside of an@Observable
type. Please note that you will have to add@ObservationIgnored
to your properties, but don't worry, they will still be observed properly.ObservableObject
restrictions, we previously could not break down anObservableObject
into smaller objects while still observing their changes. Thanks to@Observable
, we can now enforce a cleaner separation of concerns by splitting up large objects into smaller ones.StoredValue
andSecurelyStoredValue
without a property wrapper, thanks to new initializers. This makes them usable in any object, not just one that has the@Observable
macro.Notes & Deprecations
@Observable
.AsyncStoreValue
has been deprecated, as it was not widely used after its initial introduction.store.add
function is now fully deprecated. Any code callingstore.add
should instead callstore.insert
.Todo
Before Boutique 3.0 is officially released, I still need to:
ObservableObject
to@Observable
..serialized
trait.)I welcome any feedback or suggestions for Boutique 3.0, especially if you integrate Boutique into one of your projects and find ways to improve it! ❤️
This discussion was created from the release Boutique 3.0 Beta 1: An Observable Girl, Living In An Observable World.
Beta Was this translation helpful? Give feedback.
All reactions