How to Handle Duplicate Environmental Objects

Ref: Core Data with SwiftUI Tutorial: Getting Started by Keegan Rush (25 May 2020)

In setting up CoreData in SceneDelegate.swift, I’m asked to replace let contentView = MovieList() with
let context = persistentContainer.viewContext
let contentView = MovieList().environment(.managedObjectContext, context)

How do you handle this if you already have attachment to ContentView like this “let contentView = ContentView().environmentObject(userData)” used to manage about 20 parameters?

This topic was automatically closed after 166 days. New replies are no longer allowed.