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 trial

iOS Swift 2.0 Enumerations and Optionals Introduction to Enumerations Enum Methods

nil target and action? [Resolved]

I managed to get through task 1 of 2 with this code added to "enums.swift":

let done = Button.Done("Done")

..but I have really no idea what type of code is needed for task 2 of 2...?

Was there a swift course that described in detail all about target and action?

A quick google search turned up this old Treehouse blog post (but I think it's pre-Swift):


I remember there was a "target-Action link in the Teacher's notes for the Build a Simple iPhone App with Swift course (but of course who ever bothers to click through links in Teacher's Notes "whoops!" ):


I did find this stackoverflow thread that might be related (shows assigning both target and action):


It says the question asked in that thread has to do with this other stackoverflow thread which talks about selectors:


Maybe the answer can be found by understanding the answers given in those two stackoverflow threads,

but I certainly didn't see how its related to the 'func color()' code in the "Methods on Enumerations" video:


Also (just for cross reference) there is a related forum thread about that 'func color()' code (which is in the 'SwiftEnumsOptionals-S2' download for the course):


Also found:

There seems to be some documentation to the actual (real) UIStatusBarStyle enumerations ('BlackOpaque', 'BlackTranslucent', 'Default', and 'LightContent') here:


1 Answer

I found this forum thread helpful in answering this question: