IceCubesApp/IceCubesApp/App/IceCubesAppApp.swift
Thomas Ricouard 567cb4cc47 New Routeur
2022-11-29 11:46:02 +01:00

42 lines
1.1 KiB
Swift

import SwiftUI
import Timeline
import Network
import Shared
@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: {})
}
}
}
}
}
}