Last active
May 21, 2018 16:05
-
-
Save ITechRoof/c723ada9c35889aa292b6830dadf658c 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
let alertController = UIAlertController.init(title: "Destination", message: nil, preferredStyle: .actionSheet) | |
for dest in destinationArray { | |
let action = UIAlertAction.init(title: dest.key, style: .default) {[weak self] (action) in | |
self?.selectedDestinationLabel.text = "You have selected " + dest.key | |
if let userDefault = UserDefaults.init(suiteName: "group.itr.todayWidget") | |
{ | |
userDefault.setValue(dest.value, forKey: "Destination") | |
userDefault.synchronize() | |
} | |
} | |
alertController.addAction(action) | |
} | |
let cancelAction = UIAlertAction.init(title: "Cancel", style: .destructive, handler: nil) | |
alertController.addAction(cancelAction) | |
self.present(alertController, animated: true, completion: nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment