Skip to content

Instantly share code, notes, and snippets.

View jwilling's full-sized avatar

Jonathan Willing jwilling

View GitHub Profile
import SwiftUI
// This is an example of how to keep the ObservableObjects near the root of the view hierarchy
// and dispatch actions from any view easily without having to pass too many things down. This
// helps keep the views simple and makes previews a lot easier.
//
// This is inspired from what Apple is doing with `DismissAction`, `OpenURLAction`, `OpenWindowAction`, etc...
// The following is a very simple example with only two view-levels and we could pass closures directly,