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?

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

I second this post.

8 Answers

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)
    }
}

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

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

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

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

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.

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?