Your code is wrong, specifically the argument types for changeIconColor
. For example this should work:
class ViewController: UIViewController
{
@IBOutlet weak var btnMaxAloud: UIButton!
override func viewDidLoad()
{
btnMaxAloud.tintColor = UIColor.white
changeIconColor(btnMaxAloud, UIColor.red)
}
func changeIconColor(_ button: UIButton, _ color: UIColor)
{
button.tintColor = color
}
}
The function changeIconColor()
now takes a UIButton
and UIColor
as argument.
CLICK HERE to find out more related problems solutions.