Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let defaults = UserDefaults.standard
- var needIndicatorArray: [String] = ["SNAP", "EBT", "FVRX"]
- @IBAction func addNeedIndicator(_ sender: UIBarButtonItem) {
- var textField = UITextField()
- let alert = UIAlertController(title: "Add Need Indicator", message: "", preferredStyle: .alert)
- let action = UIAlertAction(title: "Add Item", style: .default) { (action) in
- //This should append the global array once the user hits the add item on the UIAlert
- self.needIndicatorArray.append(textField.text!)
- }
- alert.addTextField { (alertTextField) in
- alertTextField.placeholder = "Create new item"
- textField = alertTextField
- }
- alert.addAction(action)
- present(alert, animated: true, completion: nil)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement