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 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.