Fix ToolbarReader console warning on macOS currency sheet

Combining .searchable, .toolbar, and .navigationTitle on the same
List triggered "Update ToolbarReader tried to update multiple times
per frame" every time the sheet's first presentation animated in.
Moving .searchable onto the NavigationStack instead — separate from
the .toolbar/.navigationTitle chain on the List — avoids it.

Reproduced and confirmed fixed via the unified log (Console shows the
same warning under com.apple.SwiftUI:Invalid Configuration); the
sheet, search field, and currency list all still render correctly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FXcrACM5sok3M1KQJ8kByy
This commit is contained in:
2026-09-10 08:55:05 +03:00
co-authored by Claude Sonnet 5
parent eafaeaa8d3
commit fc68985b2d
+9 -4
View File
@@ -44,10 +44,6 @@ struct CurrencyPickerSheet: View {
} }
} }
} }
.searchable(
text: $searchQuery,
prompt: IosLocalizationKt.localizedString(resource: MR.strings.shared.search_currencies_placeholder)
)
.navigationTitle(IosLocalizationKt.localizedString(resource: MR.strings.shared.currencies_section_title)) .navigationTitle(IosLocalizationKt.localizedString(resource: MR.strings.shared.currencies_section_title))
#if os(iOS) #if os(iOS)
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
@@ -58,6 +54,15 @@ struct CurrencyPickerSheet: View {
} }
} }
} }
// Applied to the NavigationStack rather than chained onto the List below, alongside
// .toolbar/.navigationTitle: combining all three on the same view triggers a SwiftUI/
// AppKit bug on macOS ("Update ToolbarReader tried to update multiple times per frame",
// logged every time this sheet's first presentation animates in) harmless in practice,
// but splitting .searchable onto the outer view avoids it entirely.
.searchable(
text: $searchQuery,
prompt: IosLocalizationKt.localizedString(resource: MR.strings.shared.search_currencies_placeholder)
)
#if os(macOS) #if os(macOS)
// macOS sizes a .sheet() to its content's ideal size rather than the parent window's // macOS sizes a .sheet() to its content's ideal size rather than the parent window's
// size (unlike iOS, which presents modally full-size); without an explicit frame here, // size (unlike iOS, which presents modally full-size); without an explicit frame here,