Close Menu
  • Home
  • AI
  • Big Data
  • Cloud Computing
  • iOS Development
  • IoT
  • IT/ Cybersecurity
  • Tech
    • Nanotechnology
    • Green Technology
    • Apple
    • Software Development
    • Software Engineering

Subscribe to Updates

Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

    What's Hot

    Firmware-Managed Verified Boot with Hardware, Building Trust From Power-On

    July 16, 2025

    Scientists discover the moment AI truly understands language

    July 16, 2025

    Zero Trust Explained: Why Traditional

    July 16, 2025
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Big Tee Tech Hub
    • Home
    • AI
    • Big Data
    • Cloud Computing
    • iOS Development
    • IoT
    • IT/ Cybersecurity
    • Tech
      • Nanotechnology
      • Green Technology
      • Apple
      • Software Development
      • Software Engineering
    Big Tee Tech Hub
    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

    big tee tech hubBy big tee tech hubJuly 6, 2025004 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    Grouping Liquid Glass components using glassEffectUnion on iOS 26 – Donny Wals
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    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:

    lgu 2

    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:

    lgu 3

    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:

    lgu 4

    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:

    lgu 5

    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:

    lgu 2

    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

    Components Donny Glass glassEffectUnion Grouping iOS Liquid Wals
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    Four Months in the Making: SwiftMCP 1.0 is Here

    July 15, 2025

    Ultimate UICollectionView guide with iOS examples written in Swift

    July 14, 2025

    Designing custom UI with Liquid Glass on iOS 26 – Donny Wals

    July 13, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    Firmware-Managed Verified Boot with Hardware, Building Trust From Power-On

    July 16, 2025

    Scientists discover the moment AI truly understands language

    July 16, 2025

    Zero Trust Explained: Why Traditional

    July 16, 2025

    Running high-performance PostgreSQL on Azure Kubernetes Service

    July 16, 2025
    Advertisement
    About Us
    About Us

    Welcome To big tee tech hub. Big tee tech hub is a Professional seo tools Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of seo tools, with a focus on dependability and tools. We’re working to turn our passion for seo tools into a booming online website. We hope you enjoy our seo tools as much as we enjoy offering them to you.

    Don't Miss!

    Firmware-Managed Verified Boot with Hardware, Building Trust From Power-On

    July 16, 2025

    Scientists discover the moment AI truly understands language

    July 16, 2025

    Subscribe to Updates

    Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

      • About Us
      • Contact Us
      • Disclaimer
      • Privacy Policy
      • Terms and Conditions
      © 2025 bigteetechhub.All Right Reserved

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