You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Used for synchronizing access to all of this instance's mutable state. This is a temporary solution just to allow us to implement `Sendable`, and we'll revisit it in https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/3.
7
+
privateletmutex=NSLock()
8
+
9
+
privateletcoreSDK:CoreSDK
7
10
privateletlogger:AblyPlugin.Logger
8
-
privateletpluginAPI:AblyPlugin.PluginAPIProtocol
9
11
10
12
// These drive the testsOnly_* properties that expose the received ProtocolMessages to the test suite.
// This is currently exposed so that we can try calling it from the tests in the early days of the SDK to check that we can send an OBJECT ProtocolMessage. We'll probably make it private later on.
/// The API that the internal components of the SDK (that is, `DefaultLiveObjects` and down) use to interact with our core SDK (i.e. ably-cocoa).
5
+
///
6
+
/// This provides us with a mockable interface to ably-cocoa, and it also allows internal components and their tests not to need to worry about some of the boring details of how we bridge Swift types to AblyPlugin's Objective-C API (i.e. boxing).
// We hold a weak reference to the channel so that `DefaultLiveObjects` can hold a strong reference to us without causing a strong reference cycle. We'll revisit this in https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/9.
13
+
privateletweakChannel:WeakRef<ARTRealtimeChannel>
14
+
privateletpluginAPI:PluginAPIProtocol
15
+
16
+
internalinit(
17
+
channel:ARTRealtimeChannel,
18
+
pluginAPI:PluginAPIProtocol
19
+
){
20
+
weakChannel =.init(referenced: channel)
21
+
self.pluginAPI = pluginAPI
22
+
}
23
+
24
+
// MARK: - Fetching channel
25
+
26
+
privatevarchannel:ARTRealtimeChannel{
27
+
guardlet channel = weakChannel.referenced else{
28
+
// It's currently completely possible that the channel _does_ become deallocated during the usage of the LiveObjects SDK; in https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/9 we'll figure out how to prevent this.
29
+
preconditionFailure("Expected channel to not become deallocated during usage of LiveObjects SDK")
0 commit comments