2021-12-27 22:33:27 +08:00
|
|
|
//
|
|
|
|
// MainView.swift
|
|
|
|
// PushDeer
|
|
|
|
//
|
|
|
|
// Created by HEXT on 2021/12/25.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
/// APP 主界面
|
|
|
|
struct MainView: View {
|
2022-01-10 00:26:29 +08:00
|
|
|
@EnvironmentObject private var store: AppState
|
|
|
|
|
2021-12-27 22:33:27 +08:00
|
|
|
var body: some View {
|
2022-01-10 00:26:29 +08:00
|
|
|
TabView.init(selection: $store.tabSelectedIndex) {
|
2022-02-14 01:13:26 +08:00
|
|
|
|
|
|
|
MessageListView()
|
|
|
|
.tabItem({Label("消息",systemImage: "message")}).onTapGesture {
|
|
|
|
}
|
|
|
|
.tag(2)
|
|
|
|
|
2021-12-27 22:33:27 +08:00
|
|
|
DeviceListView()
|
|
|
|
.tabItem {
|
2022-01-30 01:02:44 +08:00
|
|
|
if #available(iOS 15.0, *) {
|
|
|
|
Label("设备",systemImage: "ipad.and.iphone")
|
|
|
|
} else {
|
|
|
|
Label("设备",systemImage: "laptopcomputer.and.iphone")
|
|
|
|
}
|
2021-12-27 22:33:27 +08:00
|
|
|
}
|
2022-01-10 00:26:29 +08:00
|
|
|
.tag(0)
|
2021-12-27 22:33:27 +08:00
|
|
|
|
|
|
|
KeyListView()
|
|
|
|
.tabItem{
|
|
|
|
Label("Key",systemImage: "key")
|
|
|
|
}
|
2022-01-10 00:26:29 +08:00
|
|
|
.tag(1)
|
2021-12-27 22:33:27 +08:00
|
|
|
|
|
|
|
SettingsView()
|
|
|
|
.tabItem{
|
|
|
|
Label("设置",systemImage: "gearshape")
|
|
|
|
}
|
2022-01-10 00:26:29 +08:00
|
|
|
.tag(3)
|
2021-12-27 22:33:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct MainView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
2022-01-10 00:26:29 +08:00
|
|
|
MainView().environmentObject(AppState.shared)
|
2021-12-27 22:33:27 +08:00
|
|
|
}
|
|
|
|
}
|