mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-09-27 14:10:08 +00:00
41 lines
1.1 KiB
Swift
41 lines
1.1 KiB
Swift
|
import SwiftUI
|
||
|
import Timeline
|
||
|
import Network
|
||
|
|
||
|
@main
|
||
|
struct IceCubesAppApp: App {
|
||
|
@State private var tabs: [String] = ["mastodon.social"]
|
||
|
@State private var isServerSelectDisplayed: Bool = false
|
||
|
@State private var newServerURL: String = ""
|
||
|
|
||
|
var body: some Scene {
|
||
|
WindowGroup {
|
||
|
TabView {
|
||
|
ForEach(tabs, id: \.self) { tab in
|
||
|
TimelineTabView(tab: tab)
|
||
|
.tabItem {
|
||
|
Label(tab, systemImage: "globe")
|
||
|
}
|
||
|
.toolbar {
|
||
|
ToolbarItem(placement: .navigationBarTrailing) {
|
||
|
Button {
|
||
|
isServerSelectDisplayed.toggle()
|
||
|
} label: {
|
||
|
Image(systemName: "globe")
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
.alert("Connect to another server", isPresented: $isServerSelectDisplayed) {
|
||
|
TextField(tab, text: $newServerURL)
|
||
|
Button("Connect", action: {
|
||
|
tabs.append(newServerURL)
|
||
|
newServerURL = ""
|
||
|
})
|
||
|
Button("Cancel", role: .cancel, action: {})
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|