Close Menu
geekfence.comgeekfence.com
    What's Hot

    Customer experience management (CXM) predictions for 2026: How customers, enterprises, technology, and the provider landscape will evolve 

    December 28, 2025

    What to Know About the Cloud and Data Centers in 2026

    December 28, 2025

    Why Enterprise AI Scale Stalls

    December 28, 2025
    Facebook X (Twitter) Instagram
    • About Us
    • Contact Us
    Facebook Instagram
    geekfence.comgeekfence.com
    • Home
    • UK Tech News
    • AI
    • Big Data
    • Cyber Security
      • Cloud Computing
      • iOS Development
    • IoT
    • Mobile
    • Software
      • Software Development
      • Software Engineering
    • Technology
      • Green Technology
      • Nanotechnology
    • Telecom
    geekfence.comgeekfence.com
    Home»iOS Development»Grouping Liquid Glass components using glassEffectUnion on iOS 26 – Donny Wals
    iOS Development

    Grouping Liquid Glass components using glassEffectUnion on iOS 26 – Donny Wals

    AdminBy AdminDecember 22, 2025No Comments4 Mins Read1 Views
    Facebook Twitter Pinterest LinkedIn Telegram Tumblr Email
    Grouping Liquid Glass components using glassEffectUnion on iOS 26 – Donny Wals
    Share
    Facebook Twitter LinkedIn Pinterest Email


    Published on: July 2, 2025

    On iOS 26 we have lots of new ways to reimagine our UIs with Liquid Glass. This means that we can take a look at Apple’s built-in applications and find interesting applications of Liquid Glass that we can use to enhance our understanding of how Liquid Glass components can be built, and to understand what Apple considers to be good practice for Liquid Glass interfaces.

    In this post, we’re going to replicate a control that’s part of the new maps app.

    It’s a vertical stack of two buttons in a single Liquid Glass container. Here’s what the component looks like in iOS 26:

    Grouping Liquid Glass components using glassEffectUnion on iOS 26 – Donny Wals

    And here’s the component that we’ll build in this post:

    We’re going to be making use of buttons, button styles, a GlassEffectContainer, and the glassEffectUnion view modifier to achieve our effect.

    Building the component’s buttons

    We’ll start off with a GlassEffectContainer and a VStack that contains two buttons:

    GlassEffectContainer {
        VStack {
            Button {
    
            } label: {
                Label("Locations", systemImage: "square.2.layers.3d.top.filled")
                    .bold()
                    .labelStyle(.iconOnly)
                    .foregroundStyle(Color.black.secondary)
            }
            .buttonStyle(.glass)
    
            Button {
    
            } label: {
                Label("Navigation", systemImage: "location")
                    .bold()
                    .labelStyle(.iconOnly)
                    .foregroundStyle(Color.purple)
            }
            .buttonStyle(.glass)
        }
    }

    This code will simply create two buttons on top of each other using a glass button style. The resulting UI looks like this:

    That’s not great but it’s a start. We need to apply a different buttonStyle and tint our glass to have a white background. The code below shows how to do that. For brevity, I will only show a single button; the buttonStyle should be applied to both of our buttons though:

    GlassEffectContainer {
        VStack {
            // ... 
    
            Button {
    
            } label: {
                Label("Navigation", systemImage: "location")
                    .bold()
                    .labelStyle(.iconOnly)
                    .foregroundStyle(Color.purple)
            }
            .buttonStyle(.glassProminent)
        }.tint(.white.opacity(0.8))
    }

    With this code, both buttons have a prominent style which gives them a background color instead of being fully translucent like they are with the normal glass effect:

    Now that we have our buttons set up, what we need to do is group them together into a single glass shape. To do this, we use the glassEffectUnion view modifier on both elements that we want to group.

    Let’s go ahead and do that next.

    Grouping elements using a glassEffectUnion

    A glassEffectUnion can be used to have multiple buttons contribute to a single Liquid Glass shape. In our case, we want these two buttons to be treated as a single Liquid Glass shape so they end up looking similar to the Apple Maps components we’re trying to replicate.

    First, we need to add a namespace to our container view:

    @Namespace var unionNamespace

    We’ll use this namespace as a way to connect our elements.

    Next, we need to update our buttons:

    GlassEffectContainer {
        VStack {
            Button {
    
            } label: {
                Label("Locations", systemImage: "square.2.layers.3d.top.filled")
                    .bold()
                    .labelStyle(.iconOnly)
                    .foregroundStyle(Color.black.secondary)
            }
            .buttonStyle(.glassProminent)
            .glassEffectUnion(id: "mapOptions", namespace: unionNamespace)
    
            Button {
    
            } label: {
                Label("Navigation", systemImage: "location")
                    .bold()
                    .labelStyle(.iconOnly)
                    .foregroundStyle(Color.purple)
            }
            .buttonStyle(.glassProminent)
            .glassEffectUnion(id: "mapOptions", namespace: unionNamespace)
        }.tint(Color.white.opacity(0.8))
    }

    By applying glassEffectUnion(id: "mapOptions", namespace: unionNamespace) to both views they become connected. There are a few conditions to make the grouping work though:

    • The elements must have the same id for them to be grouped
    • The glass effect that’s used must be the same for all elements in the union or they won’t be grouped
    • All components in the group must be tinted the same way or they won’t be grouped

      Now that our elements are grouped, they’re almost exactly where we want them to be:

    The buttons are a bit close to the top and bottom edges so we should apply some padding to our Label components. I like the spacing in the middle, so what I’ll do is pad the top of the first Label and the bottom of the second one:

    GlassEffectContainer {
        VStack {
            Button {
    
            } label: {
                Label("Locations", systemImage: "square.2.layers.3d.top.filled")
                    .bold()
                    .labelStyle(.iconOnly)
                    .padding(.top, 8)
                    .foregroundStyle(Color.black.secondary)
            }
            .buttonStyle(.glassProminent)
            .glassEffectUnion(id: "mapOptions", namespace: unionNamespace)
    
            Button {
    
            } label: {
                Label("Navigation", systemImage: "location")
                    .bold()
                    .labelStyle(.iconOnly)
                    .padding(.bottom, 8)
                    .foregroundStyle(Color.purple)
            }
            .buttonStyle(.glassProminent)
            .glassEffectUnion(id: "mapOptions", namespace: unionNamespace)
        }.tint(Color.white.opacity(0.8))
    }

    This completes our effect:

    In Summary

    On iOS 26, we have endless new possibilities to build interesting UI components with Liquid Glass. In this post, we tried copying a UI element from Apple’s Maps application to see how we can build a single Liquid Glass element that groups two vertically stacked buttons together.

    We used a glassEffectUnion to link together two UI Components and make them appear as a single Liquid Glass shape.

    You learned that this view modifier will group any Liquid Glass components that share the same glass style into a single shape. This means these components they will look and feel like a single unit.



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email

    Related Posts

    SwiftText | Cocoanetics

    December 28, 2025

    Uniquely identifying views – The.Swift.Dev.

    December 27, 2025

    Unable to upload my app with Transporter. Some kind of version mismatch? [duplicate]

    December 26, 2025

    Experimenting with Live Activities – Ole Begemann

    December 25, 2025

    Announcing Mastering SwiftUI for iOS 18 and Xcode 16

    December 24, 2025

    My AI Company Vision | Cocoanetics

    December 21, 2025
    Top Posts

    Understanding U-Net Architecture in Deep Learning

    November 25, 20258 Views

    Microsoft 365 Copilot now enables you to build apps and workflows

    October 29, 20258 Views

    Here’s the latest company planning for gene-edited babies

    November 2, 20257 Views
    Don't Miss

    Customer experience management (CXM) predictions for 2026: How customers, enterprises, technology, and the provider landscape will evolve 

    December 28, 2025

    After laying out our bold CXM predictions for 2025 and then assessing how those bets played out…

    What to Know About the Cloud and Data Centers in 2026

    December 28, 2025

    Why Enterprise AI Scale Stalls

    December 28, 2025

    New serverless customization in Amazon SageMaker AI accelerates model fine-tuning

    December 28, 2025
    Stay In Touch
    • Facebook
    • Instagram
    About Us

    At GeekFence, we are a team of tech-enthusiasts, industry watchers and content creators who believe that technology isn’t just about gadgets—it’s about how innovation transforms our lives, work and society. We’ve come together to build a place where readers, thinkers and industry insiders can converge to explore what’s next in tech.

    Our Picks

    Customer experience management (CXM) predictions for 2026: How customers, enterprises, technology, and the provider landscape will evolve 

    December 28, 2025

    What to Know About the Cloud and Data Centers in 2026

    December 28, 2025

    Subscribe to Updates

    Please enable JavaScript in your browser to complete this form.
    Loading
    • About Us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • Terms and Conditions
    © 2025 Geekfence.All Rigt Reserved.

    Type above and press Enter to search. Press Esc to cancel.