I'm using the following code to create and show the UIAlert:
let alert = UIAlertController(title: "Warning", message: "Are you sure you want to delete this notification?", preferredStyle: .alert)
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) { _ in
isDeletedNotification = false
}
let deleteAction = UIAlertAction(title: "Delete", style: .destructive) { _ in
DispatchQueue.main.async {
isDeletedNotification = true
self.createNotificationToPost()
}
}
alert.addAction(cancelAction)
alert.addAction(deleteAction)
present(alert, animated: true, completion: nil)
It works fine when I run the app from Xcode in the simulator and the device
When I stop Xcode and run the app in the simulator or in the device I have this:
I was using
- Xcode 14.2 (14C18).
- MacBook Pro with macOS Monterey 12.6.
I opened the same project in a different MacBook:
- Xcode 14.3.1 (14E300c).
- MacBook Pro M1 with macOS Ventura 13.4.
In both cases I have the same result, the project is damaged or something? Is possible to fix it? I have the same results with UILabel in the custom cell.
After some time I see the solution in Stack overflow. For some reason I have this code in a swift file:
extension UILabel {
override open func draw(rect: CGRect) {}
override open var intrinsicContentSize: CGSize {}
}
That was the problem, I got rid off and everything works perfect!