I have a sheet to add a new item to the modelContext, but upon dismissal the sheet doesn’t slide out smoothly but just disappears.
Running on iPhone XS, but Simulator for iPhone 15 displays same behaviour.
Sheet disappears instead of smooth transition
Here is the button inside the NewTaskView() sheet that inserts a new project.
Button( "Add new project" ) {
modelContext.insert(
Project(name: name, about: about, tasks: [Task]())
)
try? modelContext.save()
withAnimation {
dismiss()
}
}
This is the code for the button that shows the sheet thats in the ContentView() file.
Button("(Image(systemName: "pencil")) New project") {
showNewProjectSheet = true
}
.sheet(isPresented: $showNewProjectSheet) {
NewProjectSheet()
.presentationDetents([.medium])
}
Is this a performance thing? Does adding to the modelcontext just overwhelm the system?
Bhorda is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.