When creating an eventhandler from a UIButton
from the Storyboard, Swift adds @IBAction
before func
. When adding an event programmatically to a UIButton
to a func
, Swift gives a error and says I need to add @objc
in front of my method, but when I add @IBAction
, it compiles as well.
Are there an difference between the 2 and which should I use when adding an event to my UIButton
programmatically?