I have this method in a custom class:
func changeImage(btn:UIBarButtonItem, imageName: String){
btn.image = UIImage(named: imageName)
}
I would like write another method that can give me the same name passed in the 'imageName' parameter...something like:
func getImageName(btn:UIBarButtonItem) -> String{
return btn.image.someVarOrMethodWithImageName
}
I try some of properties and subProperties like
btn.image?.accessibilityIdentifier
btn.image?.imageAsset.debugDescription
btn.image?.imageAsset?.value(forKey: "named")
And others, but none of them are working.
Lot of thanks!