Skip to content

Instantly share code, notes, and snippets.

@mntone
Last active January 8, 2024 01:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mntone/1e3ed89e3ef69dbb553f75fd2a7c56f5 to your computer and use it in GitHub Desktop.
Save mntone/1e3ed89e3ef69dbb553f75fd2a7c56f5 to your computer and use it in GitHub Desktop.
// This source is under MIT license.
import UIKit
extension UIAlertAction {
public var isEnabled: Bool {
get { return value(forKey: "enabled") as! Bool }
set { setValue(newValue, forKey: "enabled") }
}
public var isChecked: Bool {
get { return value(forKey: "checked") as! Bool }
set { setValue(newValue, forKey: "checked") }
}
public var image: UIImage? {
get { return value(forKey: "image") as? UIImage }
set { setValue(newValue, forKey: "image") }
}
public var titleTextColor: UIColor? {
get { return value(forKey: "titleTextColor") as? UIColor }
set { setValue(newValue, forKey: "titleTextColor") }
}
public var imageTintColor: UIColor? {
get { return value(forKey: "imageTintColor") as? UIColor }
set { setValue(newValue, forKey: "imageTintColor") }
}
public var descriptiveText: String? {
get { return value(forKey: "_descriptiveText") as? String }
set { setValue(newValue, forKey: "_descriptiveText") }
}
@available(iOS 9.0, *)
public var keyCommandInput: String? {
get { return value(forKey: "keyCommandInput") as? String }
set { setValue(newValue, forKey: "keyCommandInput") }
}
@available(iOS 9.0, *)
public var keyCommandModifierFlags: UIKeyModifierFlags {
get { return value(forKey: "keyCommandModifierFlags") as! UIKeyModifierFlags }
set { setValue(newValue, forKey: "keyCommandModifierFlags") }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment