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 Structs and their Methods Review and Final Exam

boris said
boris said
3,607 Points

Can somebody help me fix this error:use of unresolved identifier pending

enum statusOfTask {

case pending
case doing

case complete

}

struct tasks {

var description: String

var status: statusOfTask






init(description: String, status: statusOfTask) {

    self.description = "There is no specific task yet"

    self.status = pending



}

}

2 Answers

I think it may relate to that second parameter in the initializer of your struct. You only need the first parameter, as all tasks will (in this case) start out 'pending'. Delete statusOfTask parameter and you should be golden. You can still change the status later, the init is just for the... initial stuff.

David Rynn
David Rynn
10,554 Points

Jeffrey Rosenthal , nah - it's simpler.

The line should be self.status = statusOfTask.pending instead of just "pending," which isn't telling the compiler anything. It needs to know what "pending" is referring to.