Reputation: 1
this is my ContentView()
struct ContentView: View {
@State private var selectedTab: Tab = .view1
var body: some View {
NavigationView{
ZStack{
Color(.green)
.edgesIgnoringSafeArea(.all)
VStack {
TabView(selection: $selectedTab) {
View1(selectedTab: $selectedTab)
.tabItem{Label("View-1", systemImage: "1.circle")}
.tag(Tab.view1)
View2(selectedTab: $selectedTab)
.tabItem{Label("View-2", systemImage: "2.circle")}
.tag(Tab.view2)
}
}
//.padding()
//.background(Color.pink.opacity(0.5))
//.clipShape(RoundedRectangle(cornerRadius: 20)) // Apply rounded corners
}
}
}
}
and this is my @main view
import SwiftUI
import UIKit
@main
struct NavigationTestApp: App {
init(){
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = UIColor.orange
appearance.titleTextAttributes = [.foregroundColor: UIColor.black]
appearance.largeTitleTextAttributes = [.foregroundColor: UIColor.black]
UINavigationBar.appearance().tintColor = UIColor.orange
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = appearance
UINavigationBar.appearance().compactAppearance = appearance
}
var body: some Scene {
WindowGroup {
ZStack{
Color(.green)
.edgesIgnoringSafeArea(.all)
ContentView()
}
}
}
}
I have tried putting ZStack in both @Main and ContentView(), together and separately but for the love of Xcode, it doesn't seem to be working - my navigation bar is working prim and proper tho
Upvotes: 0
Views: 70