Tour of Sharing: App Storage, Part 1

Episode #305 • Dec 2, 2024 • Subscriber-Only

“Sharing” is a brand new library for sharing state throughout your application and to external systems like user defaults, the file system, and more. We start our tour of the library by comparing it to a tool that inspired its design: SwiftUI’s @AppStorage.

Previous episode
Tour of Sharing: App Storage, Part 1
Next episode
Locked

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.

Sign in with GitHub

Introduction

Brandon

This week we are incredibly excited to announce the release of a brand new open source project, and we call it “Sharing”.

It provides an amazingly versatile tool for sharing state amongst many features in an application, and it can share state with external systems, such as user defaults, file storage, SQLite, and really anything! It works with SwiftUI when installed directly in a view, it works with UIKit when installed directly in a UIViewController or UIView, it works when installed in an @Observable model, it works anywhere, really! It’s also powered by our robust Dependencies library, which means the tool works wonderfully with testing and Xcode previews.

Stephen

It’s also worth mentioning that if any of our viewers have ever used our Composable Architecture library, then some of this content will look quite familiar to you. That’s because these state sharing tools were first built for that library, but we later realized that they would be useful in vanilla SwiftUI, UIKit, and the library even compiles for Linux, Windows and Wasm! But, even if you think you are familiar with our state sharing tools, we promise there are a few new tricks that you have never seen before.

Brandon

In the next few episodes we will give a tour of the library to show how easy it is to use while exploring some of its advanced features and showing the possibilities for customization.

We have a lot to cover, so let’s jump in!

@AppStorage in SwiftUI


References

Downloads

Sample code

Get started with our free plan

Our free plan includes 1 subscriber-only episode of your choice, access to 64 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing