75 lines
1.8 KiB
Swift
75 lines
1.8 KiB
Swift
//
|
|
// AllTab.swift
|
|
// AIGrammar
|
|
//
|
|
// Created by oscar on 2024/3/27.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
|
|
struct AllTabView: View {
|
|
// 当前正在展示的tab
|
|
@Binding var selectedTab: Int
|
|
@Binding var showPromotion: Bool
|
|
@Binding var promotionMode: PromotionDisplayType
|
|
|
|
var body: some View {
|
|
TabView(selection: $selectedTab) {
|
|
GrammarCheckView()
|
|
.tabItem {
|
|
Image(systemName: "book.fill")
|
|
Text("Grammar Check")
|
|
}
|
|
.tag(0)
|
|
|
|
WordsView()
|
|
.tabItem {
|
|
Image(systemName: "text.bubble")
|
|
Text("Words")
|
|
}
|
|
.tag(1)
|
|
|
|
TranslateView()
|
|
.tabItem {
|
|
Image(systemName: "globe")
|
|
Text("Translate")
|
|
}
|
|
.tag(2)
|
|
|
|
WordPuzzleView()
|
|
.tabItem {
|
|
Image(systemName: "timer.circle")
|
|
//Image(systemName: "rectangle.3.group")
|
|
Text("Puzzel")
|
|
}
|
|
.tag(3)
|
|
|
|
SettingsView()
|
|
.tabItem {
|
|
Image(systemName: "gear")
|
|
Text("Settings")
|
|
}
|
|
.tag(4)
|
|
}
|
|
}
|
|
}
|
|
|
|
struct AllTabView_Preview: View{
|
|
@State private var selectedTab = 2
|
|
@State private var showPromotion = false
|
|
@State private var promotionMode: PromotionDisplayType = .halfScreen
|
|
@State private var urlToOpen: String?
|
|
|
|
var body: some View {
|
|
VStack {
|
|
AllTabView(selectedTab: $selectedTab, showPromotion: $showPromotion, promotionMode: $promotionMode)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#Preview {
|
|
AllTabView_Preview()
|
|
}
|