HomeiOS DevelopmentSwiftUI iOS 26 TabView: Background will get added on scrollable content material

SwiftUI iOS 26 TabView: Background will get added on scrollable content material


I am fairly new to SwiftUI growing and began growing an App for our firm earlier this 12 months. I made a decision to have look on the brand new iOS and be certain the app would not break with it. Now I am experiencing the problem that my TabView isn’t translucent, even the content material is scrollable. Now I am questioning, what’s the deciding issue that iOS decides when and when not a background will get added. For context, I added my TabView with the 2 underlying Views (AssortmentView, ListNavigation). I additionally tried to take away the SwipeableContentView wrapper to see if I made some errors there, however the habits appears the identical.
Is there one thing I am doing improper to attain the translucent TabView?

var physique: some View {
        TabView(choice: $tabRouter.currentTab) {
            Overview(navigationManager: tabRouter.homeManager, activeType: $selectedProductType)
                .surroundings(.navigationManager, tabRouter.homeManager)
                .tabItem {
                    Label("Residence", systemImage: "home")
                }
                .tag(WogTab.dwelling)
            AssortmentView(navigationManager: tabRouter.assortmentManager, activeType: $selectedProductType)
                .surroundings(.navigationManager, tabRouter.assortmentManager)
                .tabItem {
                    Label(String(localized: "assortment"), systemImage: "checklist.bullet")
                }
                .tag(WogTab.assortment)
            SearchEntryPoint(navigationManager: tabRouter.searchManager, activeType: $selectedProductType)
                .surroundings(.navigationManager, tabRouter.searchManager)
                .tabItem {
                    Label(String(localized: "search"), systemImage: "magnifyingglass")
                }
                .tag(WogTab.search)
            CartIndex(navigationManager: tabRouter.cartManager)
                .surroundings(.navigationManager, tabRouter.cartManager)
                .tabItem {
                    Label(String(localized: "cart"), systemImage: "cart")
                }
                .tag(WogTab.cart)
                .badge(cart.amountOfItems)
                
            MyWogIndex(navigationManager: tabRouter.mywogManager)
                .tabItem {
                    Label("MyWoG", systemImage: "particular person")
                }
                .tag(WogTab.mywog)
        }
        
    }

struct AssortmentView: View {

    @ObservedObject var navigationManager: NavigationManager
    @Binding var activeType: StaticProductType
    @Namespace non-public var animation
    
    var physique: some View {
        NavigationStack(path: $navigationManager.path) {
            VStack(spacing: 0) {
                ProductTypeNavigation(
                    activeType: $activeType,
                    animation: animation
                )
                .padding(.backside, 10)
                
                SwipeableContentView(choice: $activeType, preloadAdjacent: false) { kind, shouldLoad in
                    ListNavigation(kind: kind, shouldLoad: shouldLoad)
                }
                    
            }
            .addToolbar()
            .navigationDestination(for: AppRoute.self) { route in
                change route {
                case .product(.element(let productId)):
                    ProductDetailView(productId: productId)
                case .product(.checklist(let typeId, let platformId, let listType, let navTitle)):
                    ProductList(productTypeId: typeId, platformId: platformId, listType: listType, navTitle: navTitle)
                case .dwelling(.overview(let kind)):
                    OverviewTypeView(kind: kind, shouldLoad: true)
                default:
                    EmptyView()
                }
            }
        }
    }
}

struct ListNavigation: View {
    
    @StateObject non-public var viewModel = NavigationViewModdel()
    @State non-public var nodeId: Int
    @State non-public var degree: Int
    non-public let kind : StaticProductType
    let shouldLoad: Bool
    @State non-public var contextType : StaticProductType
    
    init(kind: StaticProductType, shouldLoad: Bool) {
        self.nodeId = kind.dad or mum
        self.kind = kind
        self.contextType = kind
        if (kind.dad or mum == 0) {
            self.degree = 0
        } else {
            self.degree = 1
        }
        self.shouldLoad = shouldLoad
    }
    
    var physique: some View {
        ScrollView {
            if shouldLoad {
                if viewModel.isRefreshing {
                    ProgressView()
                } else {
                    VStack {
                        if (kind.dad or mum == 0 && self.degree > 0) || (kind.dad or mum > 0 && self.degree > 1) && !viewModel.navigation.isEmpty {
                            HStack {
                                Label("Again", systemImage: "arrow.left")
                                    .onTapGesture {
                                        self.degree -= 1
                                        if self.degree >= 1 {
                                            self.nodeId = contextType.dad or mum
                                        } else {
                                            self.nodeId = 0
                                        }
                                    }
                                Spacer()
                            }
                        }
                        ForEach(viewModel.navigation) { navigation in
                            
                            ListNavigationElement(navigation: navigation, kind: kind, degree: degree) {
                                
                                self.degree += 1
                                if self.kind == .all && self.degree == 1 {
                                    change navigation.productTypeId {
                                    case 2: contextType = .films
                                    case 3: contextType = .toys
                                    case 5: contextType = .digital
                                    case 6: contextType = .books
                                    default: contextType = .video games
                                    }
                                }
                                self.nodeId = navigation.nodeId
                            }
                        }
                    }
                    
                }
            } else {
                Coloration.clear
                    .body(maxWidth: .infinity, maxHeight: .infinity)
            }
            
        }
        .padding(10)
        .process(id: nodeId) {
            if nodeId == 0 {
                await viewModel.loadHomeNavigation(langId: 1)
            } else {
                await viewModel.loadNavigation(langId: 1, dad or mum: nodeId)
            }
        }
    }
    
    
}

SwiftUI iOS 26 TabView: Background will get added on scrollable content material

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments