Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Properly deliver events back to objective-c #11

Merged
merged 1 commit into from
Mar 24, 2016

Conversation

richardjrossiii
Copy link
Contributor

This was bugged, as HandlerConverter would be destroyed as soon as its scope was exited, causing no events to be delivered. By adding an associated object on the subscription that should be held onto by objective-c, it now only gets destroyed when the subscription does.

Fixes #7.

This was bugged, as HandlerConverter would be destroyed as soon as its
scope was exited, causing no events to be delivered. By adding an
associated object on the subscription that should be held onto by
objective-c, it now only gets destroyed when the subscription does.

Fixes #7.
@@ -254,26 +254,29 @@ extension Client {
private class HandlerConverter: SubscriptionHandling {
typealias PFObjectSubclass = PFObject

private let handler: ObjCCompat_SubscriptionHandling
private static var associatedObjectKey: Int = 0
private weak var handler: ObjCCompat_SubscriptionHandling?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we expect this ever to become nil? Not sure on why optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weak vars must be optional in swift. Compile error if not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, I completely missed the fact that it's weak now.

@nlutsenko
Copy link
Contributor

Passing back for question.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants