Cyclic references getting formed in this example, however I can't apply unowned or weak to protocol variables, what's the workaround in this situation.
protocol Report {
func done()
}
class Employee {
unowned var report: Report? //error here with using unowned or weak
func whenIAmDone() {
report.done()
}
}
class Supervisor: Report {
var employees: [Employee]?
init() {
for i in 1...5 {
var employee = Employee()
employee.report = self
employees?.append(employee)
}
}
func done() {
println("work done by...")
}
}