Swift – Solving Fatal error: Unresolved error Foundation._GenericObjCError.nilError, [:]

You are likely to get this error on CoreData when trying to update the manageObjectContext in the init() of your struct.

I was trying calling a function that saves the context upon navigating to a new view from the initializer.

A better approach instead is when the view has been rendered use the .onAppear(perform:) modifier to call the function.

Leave a Reply

Your email address will not be published.