From 8d7e6d01f4832f6e872d8d802919711169cb9c2a Mon Sep 17 00:00:00 2001 From: Pedro Giuliano Farina Date: Tue, 10 Oct 2023 18:05:21 -0300 Subject: [PATCH] Adding !targetEnvironment(macCatalyst) tag Removing background halting of pinging when using Mac Catalyst --- Sources/SwiftyPing/SwiftyPing.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/SwiftyPing/SwiftyPing.swift b/Sources/SwiftyPing/SwiftyPing.swift index e12b538..991a90d 100644 --- a/Sources/SwiftyPing/SwiftyPing.swift +++ b/Sources/SwiftyPing/SwiftyPing.swift @@ -213,14 +213,14 @@ public class SwiftyPing: NSObject { super.init() try createSocket() - #if os(iOS) + #if os(iOS) && !targetEnvironment(macCatalyst) if configuration.handleBackgroundTransitions { addAppStateNotifications() } #endif } - #if os(iOS) + #if os(iOS) && !targetEnvironment(macCatalyst) /// Adds notification observers for iOS app state changes. private func addAppStateNotifications() { NotificationCenter.default.addObserver(self, selector: #selector(didEnterBackground), name: UIApplication.didEnterBackgroundNotification, object: nil)