Skip to content

Instantly share code, notes, and snippets.

@SmartJSONEditor
Created September 22, 2023 15:45
Show Gist options
  • Save SmartJSONEditor/4565855ef2c5a289847b05f3e598095c to your computer and use it in GitHub Desktop.
Save SmartJSONEditor/4565855ef2c5a289847b05f3e598095c to your computer and use it in GitHub Desktop.
/// Requiered to use as @StateObject in a View for proper ownership.
extension ViewModel: ObservableObject {}
@Observable
class ViewModel {
/// Details
}
struct ContentView {
/// @Observed object
@StateObject private var viewModel = ViewModel()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment