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 trialAlex Busu
Courses Plus Student 11,819 PointsHow to make it work in XCode 9.1 with Swift 4
When attempting to addTarget to our first choice button there's an error that pops up around the # selector
'#selector' refers to a method that is not exposed to Objective-C
To fix this we need to add @objc in front of our function declarations.
e.g. @objc func loadFirstChoice() { ....
Can I ask what this is and why it works? I have read that @objc was implicitly assigned until swift 4. Why and what how does it affect us?
4 Answers
Jonathan Mazala
9,860 Pointsi just clicked "Fix" and it worked.
Thiago Butignon Claramunt
Courses Plus Student 791 PointsI Have the same problem!
Adam Teale
10,989 Pointsme too!
George Nhari
12,136 Pointsswift 4 click fix it works