@DTS Engineer
Sure! Please try this code with the "Settings → Accessibility → Display & Text Size → Reduce Transparency" option enabled.
Feedback ID: FB22913365
import SwiftUI
struct ContentView: View {
@State var tab = 0
var body: some View {
TabView(selection: $tab) {
TabContentView()
.tabItem {
Label("One", image: "")
}
.tag(0)
TabContentView()
.tabItem {
Label("Two", image: "")
}
.tag(1)
}
}
}
struct TabContentView: View {
@State var path = [Int]()
var body: some View {
NavigationStack(path: $path) {
NavigationStackFirstView(onNext: { path.append(0) })
.navigationDestination(for: Int.self) { destination in
Group {
switch destination {
case 0:
NavigationStackSecondView()
default:
EmptyView()
}
}
.toolbar(.hidden, for: .tabBar)
}
}
.navigationViewStyle(StackNavigationViewStyle())
}
}
struct NavigationStackFirstView: View {
let onNext: () -> Void
var body: some View {
VStack {
Text("View with tabbar")
.font(.system(size: 24))
.padding()
Button("Go to view without tabbar") {
onNext()
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.pastelGray0)
}
}
struct NavigationStackSecondView: View {
var body: some View {
ScrollView {
VStack(spacing: 0) {
ForEach(0..<25) { index in
Text("Line \(index)")
.padding()
.frame(maxWidth: .infinity)
.background(index.isMultiple(of: 2) ? Color.pastelGray2 : Color.pastelGray3)
}
}
.padding(.vertical)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.pastelGray1)
}
}
extension Color {
static let pastelGray0 = Color(red: 0.88, green: 0.88, blue: 0.90)
static let pastelGray1 = Color(red: 0.82, green: 0.83, blue: 0.85)
static let pastelGray2 = Color(red: 0.75, green: 0.76, blue: 0.78)
static let pastelGray3 = Color(red: 0.68, green: 0.69, blue: 0.71)
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: