In my Swift code below the goal would be that if the user hits the best friend button once it turns green and the 2nd time it reverts back to the original color. Green would signify true and no color would signify false. I don't know how to change the color on alert action buttons but I assume it's possible. Right now every time I hit the Best friend button it dismisses the action sheet. I want it to hold a color green and not dismiss the action sheet.
@objc func addSong(_ sender: UIBarButtonItem) {
var titleTextField = UITextField()
var releaseDateTextField = UITextField()
let alert = UIAlertController(title: "Enter name", message: "", preferredStyle: .alert)
let createAction = UIAlertAction(title: "Create", style: .default) { [self] (action) in
}
alert.addTextField { (alertTextField) in
titleTextField = alertTextField
}
let cancelAction = UIAlertAction(title: "Cancel", style: .destructive) { (action) in
self.dismiss(animated: true, completion: nil)
}
let bestFiend = UIAlertAction(title: "Best Feind", style: .default) { (action) in
releaseDateTextField.backgroundColor = .red
//self.dismiss(animated: true, completion: nil)
}
alert.addAction(bestFiend)
alert.addAction(createAction)
alert.addAction(cancelAction)
present(alert, animated: true, completion: nil)
}