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

ToDo app final exam - Please tell me if I'm on the right track. I don't want to watch the video answer yet.

import UIKit

enum Status {
    case Doing
    case Pending
    case Completed

    init() {
        self = .Doing


struct Task {
    let Description: String
    let status: Status

init(Description: String, status: (Status)) {
        self.Description = Description
        self.status = Status()

    func reminderMessage() -> String {
        return "Would you like to add a new entry?"

var task = Task(Description: "Banking", status: Status())

I spent all frikkn' day on this. I don't know why it was so difficult for me. I think it was because I was trying to add more methods and init values so I was making it harder for myself. Anyway I really tried. No errors in output or console so I think it's ok. I dissected previous challenges etc. I still don't quite know how I got everything together like I did but oh well.

I added init values for struct and enum for bonus points like it asked.

1 Answer

Looks like it's on the right track! I just finished it.

Couple of observations that might help you:

  1. You might want to use var instead of let for the stored properties description and status — at least for the status since that's designed to change, right?
  2. You might want to use lowercase d in description in the stored property to follow common convention for variable naming.
  3. You don't need the parentheses around (Status) in the initialization parameters for the Task struct.
  4. You might want to indent your initializer in the Task struct to make the struct a little easier to read. Just like you did it with the method reminderMessage.

Hope that is helpful without giving too much away :)