Last active
April 2, 2018 16:25
-
-
Save cooler333/3e8ad1fec004719d8c2d137ddf9df576 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
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