To create a custom view dialog with one cancel button in Swift, you can use a UIViewController subclass and present it modally using a UIAlertController.
First, create a new UIViewController subclass with your custom view. This view controller should include a cancelButton outlet and add the necessary actions to this button.
main.swift207 chars9 linesNext, present this view controller modally using a UIAlertController. In the handler parameter of the UIAlertAction, you can add any additional actions after the cancel button.
main.swift377 chars10 linesThis will present your custom view dialog with the cancel button. When the cancel button is tapped, the dialog will dismiss.
gistlibby LogSnag