Last active
January 4, 2016 18:07
-
-
Save Ben-G/cdc09f43b3e8193fee8b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Parent { | |
var child: Child? { | |
didSet { | |
child.callback = { [weak self] in | |
delegateCallback() | |
} | |
} | |
} | |
func delegateCallback() { | |
// ... | |
} | |
} | |
class Child { | |
var callback: (Void -> Void)? | |
private func triggerCallback() { | |
callback?() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment