Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialmattcleary2
19,953 PointsThe function signature does not match the one accepted by the handler parameter?
Hey guys, can you please explain this question to me?
A UIAlertAction instance can be initialized with a "handler" - a function that executes code when the action is started. Why does the following function not work as a handler:
func doSomething(sender: UIStepper) {}
Why does the function signature not match the one accepted by the handler parameter? What IS a signature? and how do they work?
Thank you so much
2 Answers
akin
Courses Plus Student 2,865 PointsHi Matt ;
Method signature is complete method statement like this in C# --> public void MyMethod ( int parameter) Method signature consists of method's return value (in my example, it is void) and method parameters if there are... In your programming language, handler class or its method must be defined somewhere and your method signature can match with handler's method signature (method's return value and method parameters) If you not match this you can get error message
mattcleary2
19,953 PointsThank you!