是否有一个UIKit等同于SwiftUI的confirmationDialog(_: ispresent:titleVisibility:actions:)?
可能是UIAlertController。你必须在UIViewController上呈现它。例如使用actionSheet样式。
let alert = UIAlertController(
title: "Title",
message: "Message",
preferredStyle: .actionSheet
)
alert.addAction(UIAlertAction(
title: "Delete",
style: .destructive,
handler: { _ in
// delete action
}))
alert.addAction(UIAlertAction(
title: "Cancel",
style: .cancel,
handler: { _ in
// cancel action
}))
present(alert,
animated: true,
completion: nil
)