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 Enums and Structs Enums Associated Values

cant get booktype challenge to work in enum raw values lesson

enum.swift
enum BookType : String {
    // Write your members with associated values here
    case Pdf = "b"
    case Epub = "a"
}

1 Answer

Greg Kaleka
Greg Kaleka
39,018 Points

Hi James,

I'm definitely going to recommend you take another look at the video - the answer to the first challenge comes directly from it.

Here's a hint: You're assigning these values to "a" and "b" (using an equals sign). The challenge is just asking you to associate the cases with String (no equals sign needed, and you don't need to make up any particular string values like "a" and "b"). Watch the video again and see if you can figure it out. If not, I'll give you the answer :).