Skip to content

Instantly share code, notes, and snippets.

@Ben-G
Last active January 4, 2016 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Ben-G/cdc09f43b3e8193fee8b to your computer and use it in GitHub Desktop.
Save Ben-G/cdc09f43b3e8193fee8b to your computer and use it in GitHub Desktop.
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