Skip to content

Instantly share code, notes, and snippets.

@mrcompoteee
Created November 19, 2018 12:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrcompoteee/749221922ebb20dc84e96f605a5aeae2 to your computer and use it in GitHub Desktop.
Save mrcompoteee/749221922ebb20dc84e96f605a5aeae2 to your computer and use it in GitHub Desktop.
Example of a simple retain cycle
import Foundation
class A {
var child: B?
init() {
self.child = B(parent: self)
}
}
class B {
var parent: A
init(parent: A) {
self.parent = parent
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment