Skip to content

Instantly share code, notes, and snippets.

@zats
Forked from Ben-G/NoMoreCycle.swift
Last active January 4, 2016 18:07
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 zats/e297257c6117e68a8a6b to your computer and use it in GitHub Desktop.
Save zats/e297257c6117e68a8a6b to your computer and use it in GitHub Desktop.
class Parent {
var child: Child? {
didSet {
child.callback = weak(self)?.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