Skip to content

Commit 34276d6

Browse files
author
Tom Kemp
committed
Replace _self with strongSelf
1 parent 624612b commit 34276d6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Sources/PusherConnection.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,42 +42,42 @@ public typealias PusherEventJSON = [String: AnyObject]
4242
open lazy var reachability: Reachability? = {
4343
let reachability = Reachability.init()
4444
reachability?.whenReachable = { [weak self] reachability in
45-
guard let _self = self else {
45+
guard let strongSelf = self else {
4646
print("Your Pusher instance has probably become deallocated. See https://github.com/pusher/pusher-websocket-swift/issues/109 for more information")
4747
return
4848
}
4949

50-
_self.delegate?.debugLog?(message: "[PUSHER DEBUG] Network reachable")
50+
strongSelf.delegate?.debugLog?(message: "[PUSHER DEBUG] Network reachable")
5151

52-
switch _self.connectionState {
52+
switch strongSelf.connectionState {
5353
case .disconnecting, .connecting, .reconnecting:
5454
// If in one of these states then part of the connection, reconnection, or explicit
5555
// disconnection process is underway, so do nothing
5656
return
5757
case .disconnected:
5858
// If already disconnected then reset connection and try to reconnect, provided the
5959
// state isn't disconnected because of an intentional disconnection
60-
if !_self.intentionalDisconnect { _self.resetConnectionAndAttemptReconnect() }
60+
if !strongSelf.intentionalDisconnect { strongSelf.resetConnectionAndAttemptReconnect() }
6161
return
6262
case .connected:
6363
// If already connected then we assume that there was a missed network event that
6464
// led to a bad connection so we move to the disconnected state and then attempt
6565
// reconnection
66-
_self.delegate?.debugLog?(
66+
strongSelf.delegate?.debugLog?(
6767
message: "[PUSHER DEBUG] Connection state is \(self!.connectionState.stringValue()) but received network reachability change so going to call attemptReconnect"
6868
)
69-
_self.resetConnectionAndAttemptReconnect()
69+
strongSelf.resetConnectionAndAttemptReconnect()
7070
return
7171
}
7272
}
7373
reachability?.whenUnreachable = { [weak self] reachability in
74-
guard let _self = self else {
74+
guard let strongSelf = self else {
7575
print("Your Pusher instance has probably become deallocated. See https://github.com/pusher/pusher-websocket-swift/issues/109 for more information")
7676
return
7777
}
7878

79-
_self.delegate?.debugLog?(message: "[PUSHER DEBUG] Network unreachable")
80-
_self.resetConnectionAndAttemptReconnect()
79+
strongSelf.delegate?.debugLog?(message: "[PUSHER DEBUG] Network unreachable")
80+
strongSelf.resetConnectionAndAttemptReconnect()
8181
}
8282
return reachability
8383
}()

0 commit comments

Comments
 (0)