15 C
Canberra
Tuesday, December 16, 2025

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


I am moderately new to SwiftUI creating and began creating an App for our firm earlier this 12 months. I made a decision to have look on the brand new iOS and make sure the app does not break with it. Now I am experiencing the difficulty that my TabView will not be 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: "listing.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: "individual")
                }
                .tag(WogTab.mywog)
        }
        
    }

struct AssortmentView: View {

    @ObservedObject var navigationManager: NavigationManager
    @Binding var activeType: StaticProductType
    @Namespace personal 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) { sort, shouldLoad in
                    ListNavigation(sort: sort, shouldLoad: shouldLoad)
                }
                    
            }
            .addToolbar()
            .navigationDestination(for: AppRoute.self) { route in
                change route {
                case .product(.element(let productId)):
                    ProductDetailView(productId: productId)
                case .product(.listing(let typeId, let platformId, let listType, let navTitle)):
                    ProductList(productTypeId: typeId, platformId: platformId, listType: listType, navTitle: navTitle)
                case .dwelling(.overview(let sort)):
                    OverviewTypeView(sort: sort, shouldLoad: true)
                default:
                    EmptyView()
                }
            }
        }
    }
}

struct ListNavigation: View {
    
    @StateObject personal var viewModel = NavigationViewModdel()
    @State personal var nodeId: Int
    @State personal var stage: Int
    personal let sort : StaticProductType
    let shouldLoad: Bool
    @State personal var contextType : StaticProductType
    
    init(sort: StaticProductType, shouldLoad: Bool) {
        self.nodeId = sort.mum or dad
        self.sort = sort
        self.contextType = sort
        if (sort.mum or dad == 0) {
            self.stage = 0
        } else {
            self.stage = 1
        }
        self.shouldLoad = shouldLoad
    }
    
    var physique: some View {
        ScrollView {
            if shouldLoad {
                if viewModel.isRefreshing {
                    ProgressView()
                } else {
                    VStack {
                        if (sort.mum or dad == 0 && self.stage > 0) || (sort.mum or dad > 0 && self.stage > 1) && !viewModel.navigation.isEmpty {
                            HStack {
                                Label("Again", systemImage: "arrow.left")
                                    .onTapGesture {
                                        self.stage -= 1
                                        if self.stage >= 1 {
                                            self.nodeId = contextType.mum or dad
                                        } else {
                                            self.nodeId = 0
                                        }
                                    }
                                Spacer()
                            }
                        }
                        ForEach(viewModel.navigation) { navigation in
                            
                            ListNavigationElement(navigation: navigation, sort: sort, stage: stage) {
                                
                                self.stage += 1
                                if self.sort == .all && self.stage == 1 {
                                    change navigation.productTypeId {
                                    case 2: contextType = .motion pictures
                                    case 3: contextType = .toys
                                    case 5: contextType = .digital
                                    case 6: contextType = .books
                                    default: contextType = .video games
                                    }
                                }
                                self.nodeId = navigation.nodeId
                            }
                        }
                    }
                    
                }
            } else {
                Shade.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, mum or dad: 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

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles