Commit 6833641ef2

6833641ef2e0266e0a76279d33a3bfffafb9e130

parent: ca2e56c4b6

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-10 20:34 UTC

iOS: Search in the Agenda and Folders navigation bars, not a tab

Layout: unified · split

Sources/OrgstarMobile/OrgstarMobileApp.swift +15 −10
@@ -57,7 +57,10 @@ final class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCent
57 } 57 }
58} 58}
59 59
60enum AppTab: Hashable { case agenda, folders, settings, search } 60enum AppTab: Hashable { case agenda, folders, settings }
61
62/// The search screen, pushed from the Agenda and Folders tabs.
63struct SearchRoute: Hashable {}
61 64
62extension View { 65extension View {
63 /// Readers pushed for `ReaderRoute`s. 66 /// Readers pushed for `ReaderRoute`s.
@@ -68,6 +71,9 @@ extension View {
68 .navigationDestination(for: EditorRoute.self) { route in 71 .navigationDestination(for: EditorRoute.self) { route in
69 EditorScreen(path: route.path, offset: route.offset, workspace: workspace, session: session) 72 EditorScreen(path: route.path, offset: route.offset, workspace: workspace, session: session)
70 } 73 }
74 .navigationDestination(for: SearchRoute.self) { _ in
75 SearchScreen(workspace: workspace, session: session)
76 }
71 } 77 }
72} 78}
73 79
@@ -156,21 +162,14 @@ struct RootView: View {
156 NavigationStack(path: $agendaPath) { 162 NavigationStack(path: $agendaPath) {
157 AgendaScreen(workspace: workspace, session: session, agenda: agenda, scheduler: model.scheduler) 163 AgendaScreen(workspace: workspace, session: session, agenda: agenda, scheduler: model.scheduler)
158 .equatable() 164 .equatable()
159 .toolbar { captureButton } 165 .toolbar { searchButton; captureButton }
160 .readerDestination(workspace: workspace, session: session) 166 .readerDestination(workspace: workspace, session: session)
161 } 167 }
162 } 168 }
163 Tab("Folders", systemImage: "folder", value: .folders) { 169 Tab("Folders", systemImage: "folder", value: .folders) {
164 NavigationStack { 170 NavigationStack {
165 FoldersScreen(workspace: workspace, session: session) 171 FoldersScreen(workspace: workspace, session: session)
166 .toolbar { captureButton } 172 .toolbar { searchButton; captureButton }
167 .readerDestination(workspace: workspace, session: session)
168 }
169 }
170 // An ordinary tab, not the search role, which the tab bar always puts last.
171 Tab("Search", systemImage: "magnifyingglass", value: .search) {
172 NavigationStack {
173 SearchScreen(workspace: workspace, session: session)
174 .readerDestination(workspace: workspace, session: session) 173 .readerDestination(workspace: workspace, session: session)
175 } 174 }
176 } 175 }
@@ -298,6 +297,12 @@ struct RootView: View {
298 } 297 }
299 } 298 }
300 299
300 private var searchButton: some ToolbarContent {
301 ToolbarItem(placement: .primaryAction) {
302 NavigationLink(value: SearchRoute()) { Label("Search", systemImage: "magnifyingglass") }
303 }
304 }
305
301 private var captureButton: some ToolbarContent { 306 private var captureButton: some ToolbarContent {
302 ToolbarItem(placement: .primaryAction) { 307 ToolbarItem(placement: .primaryAction) {
303 Button("Capture", systemImage: "square.and.pencil") { capture = CaptureRequest() } 308 Button("Capture", systemImage: "square.and.pencil") { capture = CaptureRequest() }
docs/manual/guide/14-ios.org +4 −3
@@ -4,13 +4,14 @@
4 4
5* Overview 5* Overview
6 6
7The app has four tabs: 7The app has three tabs:
8 8
9- Agenda :: the agenda over your folders, with capture. 9- Agenda :: the agenda over your folders, with capture.
10- Folders :: the folders of org files you added. Each shows its subfolders and org files; tap a subfolder to open it. 10- Folders :: the folders of org files you added. Each shows its subfolders and org files; tap a subfolder to open it.
11- Search :: file names and the words of headings.
12- Settings :: where the app's settings come from. 11- Settings :: where the app's settings come from.
13 12
13The search button (the magnifying glass) at the top right of Agenda and Folders opens Search.
14
14Files open in a reader first. The Edit button in the reader opens the editor. Both use the same open file, so an edit in the editor shows in the reader when you go back. 15Files open in a reader first. The Edit button in the reader opens the editor. Both use the same open file, so an edit in the editor shows in the reader when you go back.
15 16
16* Folders and file access 17* Folders and file access
@@ -145,7 +146,7 @@ See [[file:03-keys.org][Keys and commands]] for the Emacs bindings.
145 146
146* Search 147* Search
147 148
148The Search tab finds: 149Search finds:
149 150
150- Files :: up to eight org files whose path matches what you type, ranked as Quick Open ranks them on the Mac. 151- Files :: up to eight org files whose path matches what you type, ranked as Quick Open ranks them on the Mac.
151- Headings :: headings whose title or text contains your words, including unsaved edits in the open file. 152- Headings :: headings whose title or text contains your words, including unsaved edits in the open file.