Closed beforeold closed 8 months ago
Hi @beforeold, can you please provide a project that demonstrates the problem?
Hi @beforeold, can you please provide a project that demonstrates the problem?
Hi @mbrandonw Thanks for your reply. Here is the exmaple. Please checkout the PerceptionExampleView in this repo.
Thank you for the project, that helps. I can definitely see the issue. I imagine we will need to make use of some of the internal withObservationTracking
functions so that we can explicitly cancel observation. We will look into this sometime soon, but we do have some travel planned currently and so we are not sure when.
Cool, Very glad to hear there is a possible solution. Let me know if I can help.
Wish you have a nice trip.
Description
The model won't deinit when the view dismissed.
seems the WithPerceptionTracking will capture the view and the model through the withPerceptionTracking function
Checklist
@Observable
macro or another tool from theObservation
framework, please file it directly with Apple.main
branch of this package.Expected behavior
the model deinitialzed after the view dismissed
Actual behavior
the model is alive
Steps to reproduce
add a new @State property to Content of the example
add a sheet modifier to the body of the ContentView
add a button to the Form of the ContentView to show the sheet with a brand new ContentView
add a deinit log for the model the CounterModel
Run the example, Tap the Present new ContentView button, and drag to dismiss the new ContentView expectation falure for the deinit log
Perception version information
db087559dcc50eedebdc7df6a0fb0c1e188e4229
Destination operating system
iOS 16.7.3
Xcode version information
Xcode 15.0.1
Swift Compiler version information
Here is the demo project: this repo.