From 575b78fc3eabd8075f60112c59a3fcad759ad4cc Mon Sep 17 00:00:00 2001 From: Emmar Kardeslik Date: Fri, 17 Feb 2023 17:07:12 +0300 Subject: [PATCH 1/2] Fix `Run SwiftLint autocorrect` build phase not working Below are the logs: Linting Swift files at paths autocorrect Error: No lintable files found at paths: 'autocorrect' Command PhaseScriptExecution failed with a nonzero exit code --- PusherSwift.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PusherSwift.xcodeproj/project.pbxproj b/PusherSwift.xcodeproj/project.pbxproj index f249a9b0..100d8bf8 100644 --- a/PusherSwift.xcodeproj/project.pbxproj +++ b/PusherSwift.xcodeproj/project.pbxproj @@ -560,7 +560,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint autocorrect\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint --fix\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; /* End PBXShellScriptBuildPhase section */ From a5a795f92cd3e7437b7550295f98ec1d39cf1cad Mon Sep 17 00:00:00 2001 From: Emmar Kardeslik Date: Fri, 17 Feb 2023 17:07:49 +0300 Subject: [PATCH 2/2] Add changes fixed by SwiftLint --- Sources/Models/PusherChannel.swift | 8 ++++---- Sources/PusherSwift.swift | 2 +- Sources/Services/PusherConnection.swift | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/Models/PusherChannel.swift b/Sources/Models/PusherChannel.swift index 94f124cf..e1b43314 100644 --- a/Sources/Models/PusherChannel.swift +++ b/Sources/Models/PusherChannel.swift @@ -15,12 +15,12 @@ open class PusherChannel: NSObject { eventHandlersQueue.async(flags: .barrier) { self.eventHandlersInternal = newValue } } } - - private var _subscriptionCount: Int? = nil + + private var _subscriptionCount: Int? public var subscriptionCount: Int? { get { return _subscriptionCount } } - + open var subscribed = false public let name: String open weak var connection: PusherConnection? @@ -59,7 +59,7 @@ open class PusherChannel: NSObject { self.type = PusherChannelType(name: name) self.onSubscriptionCountChanged = onSubscriptionCountChanged } - + internal func updateSubscriptionCount(count: Int) { self._subscriptionCount = count self.onSubscriptionCountChanged?(count) diff --git a/Sources/PusherSwift.swift b/Sources/PusherSwift.swift index c980eada..519ee3e1 100644 --- a/Sources/PusherSwift.swift +++ b/Sources/PusherSwift.swift @@ -9,7 +9,7 @@ let CLIENT_NAME = "pusher-websocket-swift" @objcMembers @objc open class Pusher: NSObject { public let connection: PusherConnection - open weak var delegate: PusherDelegate? = nil { + open weak var delegate: PusherDelegate? { willSet { self.connection.delegate = newValue } diff --git a/Sources/Services/PusherConnection.swift b/Sources/Services/PusherConnection.swift index 87325c2b..16c55cb3 100644 --- a/Sources/Services/PusherConnection.swift +++ b/Sources/Services/PusherConnection.swift @@ -18,7 +18,7 @@ import NWWebSocket open var reconnectAttemptsMax: Int? open var reconnectAttempts: Int = 0 open var maxReconnectGapInSeconds: Double? = 120 - open weak var delegate: PusherDelegate? = nil { + open weak var delegate: PusherDelegate? { // Set the delegate for logging purposes via `debugLog(message:)` didSet { Logger.shared.delegate = self.delegate