I have a class, let's call it ClassA, with the following addTarget call.
awesomeBtn.addTarget(nil, action: #selector(awesomeMethod), for: .touchUpInside)
The compiler accepts the above line when method awesomeMethod is in ClassA (i.e. the same class as the addTarget call).
However, if awesomeMethod is NOT in ClassA, let's say it's in ClassB, then the compiler complains and I am forced to specify the class name in the action.
awesomeBtn.addTarget(nil, action: #selector(ClassB.awesomeMethod), for: .touchUpInside)
In previous versions of Swift (not exactly sure which versions), I could simply write the following, regardless of which class contained the method.
awesomeBtn.addTarget(nil, action:("awesomeMethod"), forControlEvents:.touchUpInside)
Would like to understand why this is or whether I am doing something wrong, thanks.