aboutsummaryrefslogtreecommitdiff
path: root/iGopherBrowser/ContentView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'iGopherBrowser/ContentView.swift')
-rw-r--r--iGopherBrowser/ContentView.swift82
1 files changed, 38 insertions, 44 deletions
diff --git a/iGopherBrowser/ContentView.swift b/iGopherBrowser/ContentView.swift
index 26dd941..31c9688 100644
--- a/iGopherBrowser/ContentView.swift
+++ b/iGopherBrowser/ContentView.swift
@@ -5,61 +5,55 @@
// Created by Navan Chauhan on 12/12/23.
//
+import GopherHelpers
import SwiftUI
-import SwiftData
-
import swiftGopherClient
-import GopherHelpers
struct GopherNode: Identifiable, Equatable {
- static func == (lhs: GopherNode, rhs: GopherNode) -> Bool {
- return lhs.host == rhs.host && lhs.port == rhs.port && lhs.selector == rhs.selector
- }
-
- let id = UUID()
- var host: String
- let port: Int
- var selector: String
- var message: String?
- let item: gopherItem?
- var children: [GopherNode]?
+ static func == (lhs: GopherNode, rhs: GopherNode) -> Bool {
+ return lhs.host == rhs.host && lhs.port == rhs.port && lhs.selector == rhs.selector
+ }
+
+ let id = UUID()
+ var host: String
+ let port: Int
+ var selector: String
+ var message: String?
+ let item: gopherItem?
+ var children: [GopherNode]?
}
struct ContentView: View {
- @Environment(\.modelContext) private var modelContext
- @Query private var items: [Item]
-
- @State public var hosts: [GopherNode] = []
- @State private var selectedNode: GopherNode?
-
- @State private var columnVisibility = NavigationSplitViewVisibility.automatic
- var body: some View {
-
- #if os(iOS)
- BrowserView(hosts: $hosts, selectedNode: $selectedNode)
- #else
-
- NavigationSplitView(columnVisibility: $columnVisibility) {
- SidebarView(hosts: hosts, onSelect: { node in
- selectedNode = node
-
- })
- .listStyle(.sidebar)
- } detail: {
- BrowserView(hosts: $hosts, selectedNode: $selectedNode)
- }
- #endif
- }
-
-
-
+ @State public var hosts: [GopherNode] = []
+ @State private var selectedNode: GopherNode?
-}
+ @State private var columnVisibility = NavigationSplitViewVisibility.automatic
+ var body: some View {
+ #if os(iOS)
+ BrowserView(hosts: $hosts, selectedNode: $selectedNode)
+ #else
+
+ NavigationSplitView(columnVisibility: $columnVisibility) {
+ SidebarView(
+ hosts: hosts,
+ onSelect: { node in
+ selectedNode = node
+
+ }
+ )
+ .listStyle(.sidebar)
+ } detail: {
+ BrowserView(hosts: $hosts, selectedNode: $selectedNode)
+ }
+ #endif
+ }
+
+}
#Preview {
- ContentView()
- //.modelContainer(for: Item.self, inMemory: true)
+ ContentView()
+ //.modelContainer(for: Item.self, inMemory: true)
}