Created
June 20, 2016 21:24
-
-
Save cdzombak/3141616353bb2b4e8de8289f239e0744 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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