Created
November 13, 2020 12:57
-
-
Save hasancanakgunduz/a3044cf9780e2f6ea3951ecb59935010 to your computer and use it in GitHub Desktop.
This file contains 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
class Subscriber { | |
let publisher: Publisher | |
init(publisher: Publisher) { | |
self.publisher = publisher | |
} | |
deinit { | |
print("Subscriber deinit") | |
} | |
} | |
class Publisher { | |
var subscribers: [Subscriber] = [] | |
deinit { | |
print("Publisher deinit") | |
} | |
} | |
do { | |
let publisher = Publisher() | |
let subscriber = Subscriber(publisher: publisher) | |
publisher.subscribers.append(subscriber) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment