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

Paul Denlinger
Paul Denlinger
2,380 Points

Error: Use of unresolved identifier 'Booktype'

My answer to the task is

let book = Booktype.Pdf("Game of Thrones")

But I get the above error. What is wrong?

Thanks in advance.

enum BookType {
    // Write your members with associated values here
  case Pdf(String)
  case Epub(String)

let book = Booktype.Pdf("Game of Thrones")

2 Answers

Paul you have "let book" it should be var :)

enum BookType {
  case Pdf (String)
  case Epub (String)

var book = BookType.Pdf("Game of Thrones")

I would just like to add that, besides the let/var thing, you didn't capitalize the "t" in "BookType"

Aaron already wrote this his code bit, but he didn't point it out, so I thought somebody should.

Good catch!