I'm trying to use a switch in an @IBAction
method, which is hooked to multiple buttons
@IBAction func buttonClick(sender: AnyObject) {
switch sender.currentTitle {
case "Button1":
print("Clicked Button1")
case "Button2":
print("Clicked Button2")
default:
break
}
When I try the above, I get the following error:
Expression pattern of type 'String' cannot match values of type 'String?!'