Skip to content

Instantly share code, notes, and snippets.

@cdzombak
Created June 20, 2016 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdzombak/3141616353bb2b4e8de8289f239e0744 to your computer and use it in GitHub Desktop.
Save cdzombak/3141616353bb2b4e8de8289f239e0744 to your computer and use it in GitHub Desktop.
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