Discovered a bug where Alert button colors are changed by the tint modifier.

I used .tint(.yellow) to change the default back button color. However, I noticed that the color of the alert button text, except for .destructive, also changed. Is this a bug or Apple’s intended behavior?

this occurs in iOS 18.1 and 18.1.1

Below is my code:

// App
struct TintTestApp: App {
    var body: some Scene {
        WindowGroup {
            MainView()
                .tint(.yellow)
        }
    }
}

// MainView
var mainContent: some View {
    Text("Next")
        .foregroundStyle(.white)
        .onTapGesture {
            isShowingAlert = true
        }
        .alert("Go Next View", isPresented: $isShowingAlert) {
            Button("ok", role: .destructive) {
                isNextButtonTapped = true
            }
            Button("cancel", role: .cancel) { }
        }
}

thank you!

Discovered a bug where Alert button colors are changed by the tint modifier.
 
 
Q