fix: make search bar always visible instead of toggle-behind-icon

Removed the magnifying-glass toolbar button and the isSearching state
it drove -- .searchable() now shows the search field unconditionally,
which is simpler and was requested after hands-on use showed the extra
tap added no value. Updated the spec to match.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WYqycDFsynHH9VnnK7LNSf
This commit is contained in:
2026-09-19 19:08:36 +02:00
co-authored by Claude Sonnet 5
parent ee675471f5
commit da5ad145b0
2 changed files with 2 additions and 11 deletions
+1 -10
View File
@@ -4,7 +4,6 @@ import MyPassCore
struct EntryListView: View { struct EntryListView: View {
@ObservedObject var vm: VaultViewModel @ObservedObject var vm: VaultViewModel
@State private var isSearching = false
@State private var showAddEntry = false @State private var showAddEntry = false
var body: some View { var body: some View {
@@ -25,16 +24,8 @@ struct EntryListView: View {
} }
} }
.navigationTitle("MyPass") .navigationTitle("MyPass")
.searchable(text: $vm.searchQuery, isPresented: $isSearching, prompt: "Search entries…") .searchable(text: $vm.searchQuery, prompt: "Search entries…")
.toolbar { .toolbar {
ToolbarItem(placement: .primaryAction) {
Button {
if isSearching { vm.searchQuery = "" }
isSearching.toggle()
} label: {
Image(systemName: "magnifyingglass")
}
}
ToolbarItem(placement: .primaryAction) { ToolbarItem(placement: .primaryAction) {
Button { showAddEntry = true } label: { Button { showAddEntry = true } label: {
Image(systemName: "plus") Image(systemName: "plus")
@@ -152,7 +152,7 @@ NavigationSplitView(columnVisibility:)
`NavigationSplitView` is used on **both** platforms instead of maintaining separate iOS/macOS navigation code. On iPhone-width layouts it automatically collapses the sidebar into an overlay; on iPad/Mac it can sit persistently alongside the detail column. This behavior is built into the component — no platform-specific branching needed for it. `NavigationSplitView` is used on **both** platforms instead of maintaining separate iOS/macOS navigation code. On iPhone-width layouts it automatically collapses the sidebar into an overlay; on iPad/Mac it can sit persistently alongside the detail column. This behavior is built into the component — no platform-specific branching needed for it.
- **Hamburger button** (leading toolbar item, `"line.3.horizontal"`) toggles `columnVisibility` between `.all` and `.detailOnly`, showing/hiding the sidebar. - **Hamburger button** (leading toolbar item, `"line.3.horizontal"`) toggles `columnVisibility` between `.all` and `.detailOnly`, showing/hiding the sidebar.
- **Search icon** (trailing toolbar item, `"magnifyingglass"`) toggles a `.searchable()` bar over `EntryListView`; tapping again hides it and clears the query. - **Search** is always visible via `.searchable()` over `EntryListView` (no toggle icon -- changed 2026-09-19 after hands-on use showed the extra tap added no value over an always-present search field).
- Swipe-to-delete on entry rows; toolbar `+` button opens `EntryEditView` for a new entry (see "Add-entry flow" below). - Swipe-to-delete on entry rows; toolbar `+` button opens `EntryEditView` for a new entry (see "Add-entry flow" below).
- Tapping a password field in `EntryDetailView` copies to clipboard (clears after 30 s). - Tapping a password field in `EntryDetailView` copies to clipboard (clears after 30 s).
- TOTP code displays with a countdown ring and refreshes automatically. - TOTP code displays with a countdown ring and refreshes automatically.