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

    The Easiest Way to Test Batteries

    March 13, 2026

    ios – SwiftUI toolbar symbol change without popping

    March 13, 2026

    Introducing account regional namespaces for Amazon S3 general purpose buckets

    March 13, 2026
    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»ios – SwiftUI toolbar symbol change without popping
    iOS Development

    ios – SwiftUI toolbar symbol change without popping

    big tee tech hubBy big tee tech hubMarch 13, 2026002 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    ios – SwiftUI toolbar symbol change without popping
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    I’d like my toolbar item to become badged when it’s active. I thought the best looking way to do this would be with a custom SF Symbol because that matches the rest of my app.

    But apparently .toolbar labels ignore your symbol’s text guides? Because they look perfect when I export, but when I switch symbols, they pop up and down:

    toolbar icon popping up and down as badge is added

    .toolbar {
        ToolbarItem(placement: .topBarTrailing) {
            Button {
                isFilterSheetPresented = true
            } label: {
                Image(
                    systemName: activeFilterCount == 0 ? "tray" : "tray.badge"
                )
    //          .contentTransition(.symbolEffect(.replace))
                .symbolRenderingMode(activeFilterCount > 0 ? .palette: .none)
                .foregroundStyle(
                    activeFilterCount > 0 ? Color.accentColor : Color.primary,
                    Color.primary
                )
                }
                .accessibilityLabel("Filter")
            }
    }
    

    In my app, I’m using custom symbols:

    activeFilterCount==0 ? "custom.line.3.horizontal.decrease" : "custom.line.3.horizontal.decrease.badge"
    

    but tray.badge behaves the same way and it isn’t custom – the badge makes the symbol taller, so the underlying symbol pops down when it’s badged.

    I’ve disabled the .contentTransition because that 1. just makes it fade in and out up and down rather than pop, and 2. leads to other hilarity as all the other attributes change at random intervals.

    Every AI tool suggests that I wrap it in a frame, but that only prevents my icon changing size from bothering the other parts of the toolbar. I want my symbol to be laid out according to its text guides, not it’s bounding box, and the frame doesn’t fix that at all.

    If there is no “correct” answer, I can make it mostly work with custom

    .offset(y: activeFilterCount > 0 ? -3.5 : 0)
    

    And eyeballing an offset at every text size, but that seems deeply stupid.

    I wish there was a way to use .alignmentGuide() and/or .firstTextBaseline to actually lock it down, but I don’t think those work in toolbars. And I don’t think there’s a way to stick an HStack in there that won’t pop around all the same.

    I’m also pushing along trying to make it work with .badge() but that’s not going to be the ideal appearance.



    Source link

    change iOS popping SwiftUI Symbol Toolbar
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    ios – SwiftUI iOS26+ Transition or Animation after TextField value entered

    March 12, 2026

    uikit – Why the title doesn’t follow the navigation inline state in iOS 26

    March 11, 2026

    ios – OS emoji keyboard causes UI freeze in chat TextField Flutter

    March 10, 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    The Easiest Way to Test Batteries

    March 13, 2026

    ios – SwiftUI toolbar symbol change without popping

    March 13, 2026

    Introducing account regional namespaces for Amazon S3 general purpose buckets

    March 13, 2026

    I might downgrade from my AirPods Pro 2 to the AirPods 4

    March 13, 2026
    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!

    The Easiest Way to Test Batteries

    March 13, 2026

    ios – SwiftUI toolbar symbol change without popping

    March 13, 2026

    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
      © 2026 bigteetechhub.All Right Reserved

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