Skip to content

Instantly share code, notes, and snippets.

@hasancanakgunduz
Created November 13, 2020 12:57
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 hasancanakgunduz/a3044cf9780e2f6ea3951ecb59935010 to your computer and use it in GitHub Desktop.
Save hasancanakgunduz/a3044cf9780e2f6ea3951ecb59935010 to your computer and use it in GitHub Desktop.
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