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:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user