Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
protocol ThingDelegate: class {
var fooString: String { get }
func foo()
}
class Controller: ThingDelegate {
let fooString: String
func foo() {
print("foo")
}
let myThing: Thing
init () {
fooString = ""
myThing = Thing(delegate: self) // ERROR: Constant 'self.myThing' used before being initialized
}
}
class Thing {
let delegate: ThingDelegate
init(delegate: ThingDelegate) {
self.delegate = delegate
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.