I am using Xcode 8 beta. I cannot drag multiple UIButtons from storyboard to connect to a single @IBAction in swift file. Bug? Thanks for your help.
By Using this workaround you can add existing action and also can connect multiple buttons to a single action.
I think there is a bug in Xcode8. You can add multiple/Single button to a single action /function by changing sender
to _ sender
eg :- Normal Button
@IBAction func huu(sender: UIButton) {
}
You can't add multiple buttons or single button to this action you need to simply change like this and then you can add multiple buttons by using drag and connect from storyboard.
@IBAction func huu(_ sender: UIButton) {
}
After connecting IBOutlets Xcode will show a warning like this :-
To remove this warning simple delete _
sign from the action/function. Make sure that to delete _
after connecting your IBOutlets
Hope that this will gonna help you! :)
If you change the sender to AnyObject as opposed to Any or UIButton it will allow you to connect multiple buttons to the same action.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With