I was trying to declare a closure expression in a class and have the following compile error: 'unowned' may only be applied to class and class-bound protocol types...
let id: String
var something: () -> String = { [unowned self] in
return "hello" + self.id
}
Though, the following works (with lazy):
let id: String
lazy var something: () -> String = { [unowned self] in
return "hello" + self.id
}
Why?