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 Task 1 of 2

In the editor you've been provided with two files buttons.swift that contains some source code for you to use and enums.swift where you will be writing code.

Let's start simple. To a constant named done assign an enum value of type Button with the member Done. This member takes an associated value; assign it the string "Done". enum Button { case Done(String) }

let done: Button = .Done("Done") This is my code can you guys please tell me what is wrong with it! Thank you I am confused!

What does the error message say?

You are nearly there. I think that you have to remove the = sign and also the : between let done; Button . Replace : with =

I hope this helps

2 Answers

You were pretty close! What they're asking you to do is assign an enum value of type Button to a constant named done. What you did was assign an enum member to a constant of type Button, but that isn't what they're looking for. Let me show you how i did it:

let done = Button.Done("Done")

I hope this helps.

ohhh Thank you so much =)

No problem!