Post

Replies

Boosts

Views

Activity

Reply to Swiftdata - reset the database from archived files with swiftui without a app restart
Thank you for your reply, and I agree that is what is happening. I do the following - reloading reinitialise the model container and get no errors as my code below .... let schema = Schema([....my different models are here]) let config = ModelConfiguration("database", schema: schema) do { // Recreate the container with the same store URL let container = try ModelContainer(for: schema, configurations: config) print("ModelContainer reinitialized successfully!") } catch { print("Failed to reinitialize ModelContainer: (error)") } } maybe I will create a function and places in the contentview view (the main view that initially creates the container) and change it to have a reload that will reset the container and as it is passed in the environment should get reloaded. thanks
Feb ’25