From f62634f2e5d820dff89c37a13d7ba08f59b64f13 Mon Sep 17 00:00:00 2001 From: Dmytro Date: Tue, 12 Sep 2023 09:59:56 -0700 Subject: [PATCH 1/2] remove completionBlock to match xcode 15 --- PSOperations/Operation.swift | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/PSOperations/Operation.swift b/PSOperations/Operation.swift index deaa33b..fda874e 100644 --- a/PSOperations/Operation.swift +++ b/PSOperations/Operation.swift @@ -19,20 +19,6 @@ open class Operation: Foundation.Operation { private static var psoperationContext = 0 - /* The completionBlock property has unexpected behaviors such as executing twice and executing on unexpected threads. BlockObserver - * executes in an expected manner. - */ - @available(*, deprecated, message: "use BlockObserver completions instead") - override open var completionBlock: (() -> Void)? { - get { - return nil - } - // swiftlint:disable:next unused_setter_value - set { - fatalError("The completionBlock property on NSOperation has unexpected behavior and is not supported in PSOperations.Operation 😈") - } - } - // use the KVO mechanism to indicate that changes to "state" affect other properties as well @objc class func keyPathsForValuesAffectingIsReady() -> Set { return ["state" as NSObject] From 307782fd0b56e5ef1b512db65c02111d768417a8 Mon Sep 17 00:00:00 2001 From: Dmytro Date: Fri, 22 Sep 2023 06:17:23 -0700 Subject: [PATCH 2/2] update commit --- PSOperations/Operation.swift | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/PSOperations/Operation.swift b/PSOperations/Operation.swift index fda874e..a58d974 100644 --- a/PSOperations/Operation.swift +++ b/PSOperations/Operation.swift @@ -18,6 +18,26 @@ public typealias PSOperation = Operation open class Operation: Foundation.Operation { private static var psoperationContext = 0 + +#if swift(>=5.9) + public typealias CompletionBlock = @Sendable () -> Void +#else + public typealias CompletionBlock = () -> Void +#endif + + /* The completionBlock property has unexpected behaviors such as executing twice and executing on unexpected threads. BlockObserver + * executes in an expected manner. + */ + @available(*, deprecated, message: "use BlockObserver completions instead") + override open var completionBlock: CompletionBlock? { + get { + return nil + } + // swiftlint:disable:next unused_setter_value + set { + fatalError("The completionBlock property on NSOperation has unexpected behavior and is not supported in PSOperations.Operation 😈") + } + } // use the KVO mechanism to indicate that changes to "state" affect other properties as well @objc class func keyPathsForValuesAffectingIsReady() -> Set {