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 2.0 Protocols Swift 2.0 Protocols Why Are Protocols Useful?

Ben Drago
PLUS
Ben Drago
Courses Plus Student 2,937 Points

"Why Are Protocols Useful?" section missing Teacher's Notes

The video references a code snippet that should be in the Teacher's Note section.

The download with the solutions for this course appear to be outdated, and do not contain this code either.

Misha Holtz
Misha Holtz
4,655 Points

I second this post.

8 Answers

Alexandru Stefanescu
Alexandru Stefanescu
2,195 Points

Hope this helps:

import Foundation

enum EmployeeType {
    case Manager
    case NotManager
}

class Employee {

    let name: String
    let address: String
    let startDate: NSDate
    let type: EmployeeType

    var department: String?
    var reportsTo: String?

    init(fullName: String, employeeAddress: String, employeeStartDate: NSDate, employeeType: EmployeeType) {
        self.name = fullName
        self.address = employeeAddress
        self.startDate = employeeStartDate
        self.type = employeeType

    }

    func pay() -> (basePay: Double, benefits: Double, deductions: Double, vacationTime: Int) {
        return (0, 0, 0, 0)
    }

}

func payEmployee (employee: Employee) {
    let paycheck = employee.pay()
}

class HourlyEmployee: Employee {
    var hourlyWage: Double = 15.00
    var hoursWorked: Double = 0
    let availableVacation = 0

    override func pay() -> (basePay: Double, benefits: Double, deductions: Double, vacationTime: Int) {
        return (hourlyWage * hoursWorked, 0, 0, availableVacation)
    }
}
Matthew McCurdy
Matthew McCurdy
2,276 Points

This was flagged a month ago and hasn't been corrected. What's going on, guys? Come on.

David Rynn
David Rynn
10,554 Points

Pasan Premaratne put the code snippet in the next section (I'm assuming by accident).

JT Keller
JT Keller
12,731 Points

+1 for making sure that any teacher's notes that are referenced in the video are provided.

Now it's been 2 months since @David Rynn mentioned the code snippet issue. Please correct this.

David Hernandez
David Hernandez
4,358 Points

It's now been 4 months, I know it's not a big deal, but it would be helpful to correct this please.

Charlie O'Shea
Charlie O'Shea
18,737 Points

6 months and counting. This means that every single person to take the Swift 2.0 track has now been faced with this unnecessary distraction at a point in the course where the complexity is stepping up.

Abraham Juliot
Abraham Juliot
47,353 Points

Email treehouse support or tweet the teacher directly. That's the best method to correct course errors.

Anyone interested in starting a Slack group where we can complain about this and chat in real-time?