Skip to content

Instantly share code, notes, and snippets.

@cooler333
Last active April 2, 2018 16:25
Show Gist options
  • Save cooler333/3e8ad1fec004719d8c2d137ddf9df576 to your computer and use it in GitHub Desktop.
Save cooler333/3e8ad1fec004719d8c2d137ddf9df576 to your computer and use it in GitHub Desktop.
import Foundation
class A: NSObject {
weak var delegate: B?
}
class B: NSObject {
weak var delegate: A?
}
var a: A?
var b: B?
func configure() {
a = A()
b = B()
a?.delegate = b
b?.delegate = a
}
configure()
print(a)
print(b)
print(a?.delegate)
print(b?.delegate)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment