I'm just learning, please help me with the code
import SwiftUI
struct MainView: View {
// Текущая вкладка.
@State var currentTab: String = "Журнал расходов"
// Пункт меню..
@State var showMenu: Bool = false
// Скрытие собственной панели вкладок.
init() {
UITabBar.appearance().isHidden = true
}
var body: some View {
ZStack{
// Пользовательское боковое меню.
SideMenu(currentTab: $currentTab)
// Просмотр главной вкладки.
CustemTabView(currentTab: $currentTab, showMenu: $showMenu)
// Задаем радиус угла.
.cornerRadius(showMenu ? 25 : 0)
// Выполнение 3D-вращения.
.rotation3DEffect(.init(degrees: showMenu ? -15 : 0), axis: (x: 0, y: 1, z: 0),anchor: .trailing)
// Раздвигающий вид.
.offset(x: showMenu ? getRect().width / 1.7 : 0)
.ignoresSafeArea()
}
// Всегда темный режим.
.preferredColorScheme(.dark)
}
}
#Preview {
ContentView()
}
extension View {
func getSafeArea() -> UIEdgeInsets {
guard let screen =
UIApplication.shared.connectedScenes.first as?
UIWindowScene else {
return .zero
}
guard let safeArea = screen.windows.first?.safeAreaInsets
else {
return.zero
}
return safeArea
}
}
this is where I hide all the tabs
init() {
UITabBar.appearance().isHidden = true
}
But I don't want these tabs to be hidden
import SwiftUI
struct CarExpensesView: View {
// Просмотр свойств
@State private var currentTab: String = ""
var body: some View {
TabView(selection: $currentTab) {
AvtoExpensesView(currentTab: $currentTab)
.badge(2)
.tabItem {
Label("Расходы", systemImage: "creditcard.fill")
}
.tag("Расходы")
CategoriesView()
.badge(2)
.tabItem {
Label("Категории", systemImage: "list.clipboard.fill")
}
.tag("Категории")
}
}
}
#Preview {
CarExpensesView()
}