How to create UIAlertView in Swift? (UIAlertController)
Hello everyone! I just started learning Swift and iOS development. I need to show the user a simple alert with an "OK" button. I watched old tutorials, and they all use UIAlertView. But when I write this code in Xcode:
let alert = UIAlertView(title: "Hello", message: "This is a message", delegate: nil, cancelButtonTitle: "OK")\nalert.show()\n\nXcode gives an error: 'UIAlertView' is unavailable: UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead.
\n\nI understand that UIAlertView is no longer used, but I can't figure out UIAlertController. How do I properly create the same alert? Do I need to set up a delegate? How do I handle