1

I found a reproducible issue in iOS 18+. When a SwiftUI TabView contains a Map (MKMapView), any custom UITabBarAppearance badge color is ignored while that tab is active. As soon as you switch to a tab without a Map, the custom badge color is applied again.

Minimal example:

struct ContentView: View {
    var body: some View {
        TabView {
            Tab {
                Map()
            } label: {
                Label("Map", systemImage: "map")
            }

            Tab {
                Text("Second")
            } label: {
                Label("Profile", systemImage: "person")
            }
            .badge(2)
        }
        .onAppear {
            let appearance = UITabBarAppearance()
            appearance.stackedLayoutAppearance.normal.badgeBackgroundColor = .black
            UITabBar.appearance().standardAppearance = appearance
            UITabBar.appearance().scrollEdgeAppearance = appearance
        }
    }
}

First tab enter image description here

Looks like MapKit forces its own tab bar appearance. Anyone found a workaround?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.