Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors, SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2), PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager, all feature UIs (Login, Connect, Browse, Backup, History, Settings), Shared components and theme. Builds clean with zero errors. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
73
Features/MainTabView.swift
Normal file
73
Features/MainTabView.swift
Normal file
@@ -0,0 +1,73 @@
|
||||
import SwiftUI
|
||||
|
||||
struct MainTabView: View {
|
||||
@EnvironmentObject var store: ConnectionStore
|
||||
|
||||
var body: some View {
|
||||
AdaptiveLayout()
|
||||
}
|
||||
}
|
||||
|
||||
// iPad uses NavigationSplitView; iPhone uses TabView
|
||||
struct AdaptiveLayout: View {
|
||||
@Environment(\.horizontalSizeClass) private var sizeClass
|
||||
|
||||
var body: some View {
|
||||
if sizeClass == .regular {
|
||||
iPadSidebarLayout()
|
||||
} else {
|
||||
iPhoneTabLayout()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct iPhoneTabLayout: View {
|
||||
var body: some View {
|
||||
TabView {
|
||||
NavigationStack { BackupView() }
|
||||
.tabItem { Label("Backup", systemImage: "arrow.up.doc.fill") }
|
||||
|
||||
NavigationStack { HistoryView() }
|
||||
.tabItem { Label("History", systemImage: "clock.arrow.circlepath") }
|
||||
|
||||
NavigationStack {
|
||||
if let conn = ConnectionStore.shared.savedConnection {
|
||||
BrowseView(connection: conn, selectedPath: .constant("/"))
|
||||
}
|
||||
}
|
||||
.tabItem { Label("Browse", systemImage: "folder.fill") }
|
||||
|
||||
NavigationStack { SettingsView() }
|
||||
.tabItem { Label("Settings", systemImage: "gearshape.fill") }
|
||||
}
|
||||
.tint(AppTheme.blue)
|
||||
}
|
||||
}
|
||||
|
||||
struct iPadSidebarLayout: View {
|
||||
@State private var selection: String? = "backup"
|
||||
|
||||
var body: some View {
|
||||
NavigationSplitView {
|
||||
List(selection: $selection) {
|
||||
Label("Backup", systemImage: "arrow.up.doc.fill").tag("backup")
|
||||
Label("History", systemImage: "clock.arrow.circlepath").tag("history")
|
||||
Label("Browse", systemImage: "folder.fill").tag("browse")
|
||||
Label("Settings", systemImage: "gearshape.fill").tag("settings")
|
||||
}
|
||||
.navigationTitle("NASBackup")
|
||||
} detail: {
|
||||
switch selection {
|
||||
case "backup": BackupView()
|
||||
case "history": HistoryView()
|
||||
case "browse":
|
||||
if let conn = ConnectionStore.shared.savedConnection {
|
||||
BrowseView(connection: conn, selectedPath: .constant("/"))
|
||||
}
|
||||
case "settings": SettingsView()
|
||||
default: BackupView()
|
||||
}
|
||||
}
|
||||
.tint(AppTheme.blue)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user