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 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,021 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 :).