Since I downloaded the Xcode beta version, a strange process has occurred with the views with my navigation. I couldn’t find anything online about this, I’ve also searched for transitions and animations in my code, but unfortunately I couldn’t find anything.
I hope you can help me further.
Here is my navigation contentview code:
import SwiftUI
struct ContentView: View {
@State private var selectedTab: Tab = .house
init() {
UITabBar.appearance().isHidden = true
}
@State var isFullView:Bool = false
@State private var showSignInView: Bool = false
@StateObject private var designSelection = Design_selection()
var body: some View {
ZStack {
VStack(spacing: 0) {
if !showSignInView {
TabView(selection: $selectedTab) {
dashboard_iphone_view(profilViewModel: ProfilViewModel())
.toolbar(.hidden, for: .tabBar)
.toolbarBackground(.hidden, for: .tabBar)
.environmentObject(designSelection)
.tag(Tab.house)
todo_iphone_view(profilViewModel: ProfilViewModel(), design_selection: Design_selection())
.toolbar(.hidden, for: .tabBar)
.toolbarBackground(.hidden, for: .tabBar)
.tag(Tab.list)
pomodoro_timer_iphone(isFullView: $isFullView, profilViewModel: ProfilViewModel(), design_selection: Design_selection())
.toolbar(.hidden, for: .tabBar)
.toolbarBackground(.hidden, for: .tabBar)
.tag(Tab.clock)
CalendarView(profilViewModel: ProfilViewModel())
.toolbar(.hidden, for: .tabBar)
.toolbarBackground(.hidden, for: .tabBar)
.tag(Tab.calendar)
habit_main(profilViewModel: ProfilViewModel(), design_selection: Design_selection())
.toolbar(.hidden, for: .tabBar)
.toolbarBackground(.hidden, for: .tabBar)
.tag(Tab.habit)
}
}
}
if isFullView == false{
VStack {
Spacer()
CustomTabBar(selectedTab: $selectedTab)
}
}
}
.edgesIgnoringSafeArea(.bottom)
.statusBarHidden(isFullView)
}
}
#Preview {
ContentView()
}
And this is my CustomTabBar:
import SwiftUI
enum Tab: String, CaseIterable {
case house = "house"
case list = "list.bullet.clipboard"
case clock = "clock"
case calendar = "calendar"
case habit = "water.waves"
}
struct CustomTabBar: View {
@Binding var selectedTab: Tab
private var fillImage: String {
selectedTab.rawValue
}
private var tabColor: Color {
return Color(.white)
}
var body: some View {
VStack {
HStack {
ForEach(Tab.allCases, id: .rawValue) { tab in
Spacer()
VStack(spacing: 4) {
Image(systemName: tab.rawValue)
.scaleEffect(selectedTab == tab ? 1.2 : 1.0)
.foregroundColor(selectedTab == tab ? tabColor : Color(.white))
.font(.title3)
.onTapGesture {
withAnimation(.easeInOut(duration: 0.2)) {
selectedTab = tab
}
}
if selectedTab == tab {
Circle()
.fill(Color.white)
.frame(width: 5, height: 5)
}
HStack{
}
.frame(height: 10)
}
Spacer()
}
}
}
.frame(height: 80)
.background(.thinMaterial)
.clipShape(
.rect(
topLeadingRadius: 40,
bottomLeadingRadius: 0,
bottomTrailingRadius: 0,
topTrailingRadius: 40
)
)
}
}
struct CustomTabBar_Previews: PreviewProvider {
static var previews: some View {
CustomTabBar(selectedTab: .constant(.house))
}
}