Home > Software engineering >  In alert text are coming as uppercase though no property is added in swiftUI?
In alert text are coming as uppercase though no property is added in swiftUI?

Time:08-26

I have an alert which is specified as below , and its showing alert is just a bool

.alert("Do you want to delete the event and its details?", is Presented: $showingAlert)

But it's coming always as bold

CodePudding user response:

       let logout = UIAlertController(title: "Logout", message: 
      "Are you sure you want to logout?", preferredStyle: 
         UIAlertController.Style.alert)

        logout.addAction(UIAlertAction(title: "No", style: .cancel, handler: { (action: UIAlertAction!) in
        logout.dismiss(animated: true)
        }))
        
        present(logout, animated: true, completion: nil)

CodePudding user response:

try this example code to display your alert with the text ...as it is written, First letter of the text is uppercase.

import Foundation
import SwiftUI

struct ContentView: View {
    @State var showingAlert = false
    
    var body: some View {
        Button("Show alert") { showingAlert = true }
            .alert("Do you want to delete the event and its details?", isPresented: $showingAlert, actions: {})
    }
}
  • Related