field_ios

In-the-field app for Radroots on iOS
git clone https://radroots.dev/git/field_ios.git
Log | Files | Refs | LICENSE

commit 8550af403b49a80aab0324eecd441376b341fe97
parent 8a94e2310397bf7205bbc635a2a682a0bbc670bc
Author: triesap <triesap@radroots.dev>
Date:   Sat,  4 Oct 2025 21:20:00 +0100

Refactor SwiftUI views to fix console errors in navigation and form layouts.

Diffstat:
MRadroots/App/AppEntry.swift | 18+++++++++---------
MRadroots/Views/HomeView.swift | 17+++++++++++------
MRadroots/Views/ProfileView.swift | 22+++++++++++++---------
MRadroots/Views/RelaysView.swift | 1+
4 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/Radroots/App/AppEntry.swift b/Radroots/App/AppEntry.swift @@ -10,15 +10,15 @@ public struct AppEntry<Main: View>: View { } public var body: some View { - NavigationStack { - Group { - switch appState.bootstrapPhase { - case .idle, .starting: - SplashView() - case .ready: - if appState.canShowAppContent { - main() - } else { + Group { + switch appState.bootstrapPhase { + case .idle, .starting: + SplashView() + case .ready: + if appState.canShowAppContent { + main() + } else { + NavigationStack { SetupView() } } diff --git a/Radroots/Views/HomeView.swift b/Radroots/Views/HomeView.swift @@ -11,13 +11,17 @@ struct HomeView: View { var body: some View { TabView(selection: $selection) { - HomeDashboardView() - .tabItem { Label("Home", systemImage: "house.fill") } - .tag(HomeTab.home) + NavigationStack { + HomeDashboardView() + } + .tabItem { Label("Home", systemImage: "house.fill") } + .tag(HomeTab.home) - SettingsView() - .tabItem { Label("Settings", systemImage: "gearshape.fill") } - .tag(HomeTab.settings) + NavigationStack { + SettingsView() + } + .tabItem { Label("Settings", systemImage: "gearshape.fill") } + .tag(HomeTab.settings) } } } @@ -59,6 +63,7 @@ private struct HomeDashboardView: View { } } } + .listStyle(.insetGrouped) .inlineNavigationTitle("Home") } } diff --git a/Radroots/Views/ProfileView.swift b/Radroots/Views/ProfileView.swift @@ -23,7 +23,8 @@ public struct ProfileView: View { public var body: some View { Form { Section(header: Text("Profile")) { - LabeledContent("name") { + VStack(alignment: .leading, spacing: 8) { + Text("name").font(.footnote).foregroundStyle(.secondary) TextField("name", text: $name) .textInputAutocapitalization(.never) .autocorrectionDisabled() @@ -32,7 +33,8 @@ public struct ProfileView: View { .onSubmit { focusedField = .displayName } } - LabeledContent("display_name") { + VStack(alignment: .leading, spacing: 8) { + Text("display_name").font(.footnote).foregroundStyle(.secondary) TextField("display name", text: $displayName) .textInputAutocapitalization(.words) .autocorrectionDisabled() @@ -41,7 +43,8 @@ public struct ProfileView: View { .onSubmit { focusedField = .nip05 } } - LabeledContent("nip05") { + VStack(alignment: .leading, spacing: 8) { + Text("nip05").font(.footnote).foregroundStyle(.secondary) TextField("user@example.com", text: $nip05) .keyboardType(.emailAddress) .textInputAutocapitalization(.never) @@ -51,7 +54,8 @@ public struct ProfileView: View { .onSubmit { focusedField = .about } } - LabeledContent("about") { + VStack(alignment: .leading, spacing: 8) { + Text("about").font(.footnote).foregroundStyle(.secondary) TextEditor(text: $about) .frame(minHeight: 120) .focused($focusedField, equals: .about) @@ -74,16 +78,16 @@ public struct ProfileView: View { } } } + .listStyle(.insetGrouped) + .scrollDismissesKeyboard(.interactively) .inlineNavigationTitle("Profile") .toolbar { ToolbarItem(placement: .topBarTrailing) { if isLoading || isPosting { ProgressView() } } - ToolbarItem(placement: .keyboard) { - HStack { - Spacer() - Button("Done") { focusedField = nil } - } + ToolbarItemGroup(placement: .keyboard) { + Spacer() + Button("Done") { focusedField = nil } } } .onAppear { loadProfile() } diff --git a/Radroots/Views/RelaysView.swift b/Radroots/Views/RelaysView.swift @@ -32,6 +32,7 @@ struct RelaysView: View { } } } + .listStyle(.insetGrouped) .inlineNavigationTitle("Relays") } }