Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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: