Last active
February 23, 2021 09:29
-
-
Save amarodeabreu/7bc3793f2c56067fa9a1db161d1988ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Function to display UIAlert when "Hit Me!" button is clicked | |
@IBAction func showAlert(){ | |
//New instance of UIAlertController - Apple view controller | |
let showAlert = UIAlertController(title: "Hello, World", message: "This is my first swift app", preferredStyle: .alert) | |
//New instance of UIAlertAction - Apple view controller action | |
let action = UIAlertAction(title: "Awesome sauce", style: .default, handler: nil) | |
//Add action to view controller | |
showAlert.addAction(action) | |
//Present action on view controller with animation | |
present(showAlert, animated: true, completion: nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment