Post

Replies

Boosts

Views

Activity

Reply to SwiftUI retain cycle with .searchable
Yes that makes sense. Now the search model is created in the ancestor view ... I think that would be less ideal. The model is very light weight and essentially only providing a bindable publisher and some (web) search functionality ... this probably doesn't need to outlive that view and it would be ok to create a new model alongside a view push ... Interestingly a TextField with the same binding to Retainer would behave as expected ... the model would be deallocated when the view is removed from the view stack ...
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’22