Post

Replies

Boosts

Views

Activity

Reply to SwiftUI retain cycle with .searchable
This still happens today on Xcode 26.4.1 / iOS 26.4. Working around it by weakly capturing the view model in the binding: .searchable( text: Binding(get: { [weak viewModel] in viewModel?.searchText ?? "" }, set: { [weak viewModel] in viewModel?.searchText = $0 }), isPresented: $isSearchPresented, placement: .toolbar, prompt: Text(localizations.searchPrompt) )
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’26
Reply to SwiftUI retain cycle with .searchable
This still happens today on Xcode 26.4.1 / iOS 26.4. Working around it by weakly capturing the view model in the binding: .searchable( text: Binding(get: { [weak viewModel] in viewModel?.searchText ?? "" }, set: { [weak viewModel] in viewModel?.searchText = $0 }), isPresented: $isSearchPresented, placement: .toolbar, prompt: Text(localizations.searchPrompt) )
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’26