Created
May 4, 2017 12:26
-
-
Save JayachandraA/22e92b324e0b5788090137ec82985d87 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
//create object | |
let alertController = UIAlertController(title: "Share ♂", message: "Share the your content on social media.", preferredStyle: .actionSheet) | |
// create action objects | |
// which can be useed to handle the different action when user tapped on any one of them | |
let facebookAction = UIAlertAction(title: "Facebook", style: .default) { (action) in | |
//handle facebook button action | |
print("facebook button tapped") | |
self.performLogin(alertController: alertController) | |
} | |
let twitterAction = UIAlertAction(title: "Twitter", style: .default) { (action) in | |
//handle cancel button | |
print("twitter button tapped") | |
} | |
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) { (action) in | |
//handle cancel button | |
print("cancel button tapped") | |
} | |
//add two button action to the alert controller | |
alertController.addAction(facebookAction) | |
alertController.addAction(twitterAction) | |
alertController.addAction(cancelAction) | |
//display | |
present(alertController, animated: true, completion: nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment