SwiftUI: How to set alert message color?

example code

import SwiftUI

struct ContentView: View {
  @State var showAlert = false
   
  var body: some View {
    Button(action: {
      showAlert = true
    }) {
      Text("OK")
    }.alert(isPresented: $showAlert) {
      Alert(
        title: Text("test"),
        message: Text("alert alert alert").foregroundColor(.red)
      )
    }
  }
}

You can't change the colour of the alert's message in SwiftUI.

There are ways to customise the alert message in a UIAlertController, but I recommend staying clear of them as it uses private APIs.

SwiftUI: How to set alert message color?
 
 
Q