HomeiOS DevelopmentHow one can make the ToolbarItemGroup within the toolbar background with glass...

How one can make the ToolbarItemGroup within the toolbar background with glass impact?


I attempted accessing the background of a ToolbarItemGroup, however it didn’t work. Is it at present attainable in iOS 26 to use a liquid glass (blur) impact to the background of a ToolbarItemGroup, or is that this not supported?

How one can make the ToolbarItemGroup within the toolbar background with glass impact?

import SwiftUI


struct ContentView: View {
    
    var physique: some View {
        NavigationStack {
            VStack {
                ContentUnavailableView {
                    Label("Adapting toolbar components to the Liquid Glass Design System", systemImage: "tray.fill")
                } description: {
                    Textual content("Discover find out how to design and implement toolbars in iOS 26 utilizing Apple’s new Liquid Glass.")
                        .padding()
                }
            }
            
            .toolbar {
                ToolbarItemGroup(placement: .topBarTrailing) {
                    Button("Draw", systemImage: "pencil") {
                        // Button motion right here
                    }.glassEffect()
                    
                    Button("Erase", systemImage: "eraser") {
                        // Button motion right here
                    }.glassEffect()
                }
                
                ToolbarSpacer(.fastened, placement: .topBarTrailing)
                
                ToolbarItem(placement: .topBarTrailing) {
                    Button("Save", systemImage: "checkmark") {
                        // Button motion right here
                    }
                    .buttonStyle(.glass)
                    
                    
                    .glassEffect()
                }
            }
            .background(Shade.purple)
            
        }
    }
    
}

#Preview {
    ContentView()
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments