Skip to content

Commit 873758d

Browse files
committed
add support for visionOS
1 parent 157685d commit 873758d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Sources/Aptabase/Aptabase.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
#if os(iOS)
3+
#if os(iOS) || os(visionOS)
44
import UIKit
55
#elseif os(macOS)
66
import AppKit
@@ -36,7 +36,7 @@ public class Aptabase: NSObject {
3636
client = AptabaseClient(appKey: appKey, baseUrl: baseUrl, env: env, options: options)
3737

3838
let notifications = NotificationCenter.default
39-
#if os(tvOS) || os(iOS)
39+
#if os(tvOS) || os(iOS) || os(visionOS)
4040
notifications.addObserver(self, selector: #selector(startPolling), name: UIApplication.willEnterForegroundNotification, object: nil)
4141
notifications.addObserver(self, selector: #selector(stopPolling), name: UIApplication.didEnterBackgroundNotification, object: nil)
4242
#elseif os(macOS)

Sources/Aptabase/EnvironmentInfo.swift

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#if os(iOS)
1+
import Foundation
2+
3+
#if os(iOS) || os(visionOS)
24
import UIKit
35
#elseif os(macOS)
46
import AppKit
@@ -50,6 +52,8 @@ struct EnvironmentInfo {
5052
"watchOS"
5153
#elseif os(tvOS)
5254
"tvOS"
55+
#elseif os(visionOS)
56+
"visionOS"
5357
#else
5458
""
5559
#endif
@@ -59,12 +63,10 @@ struct EnvironmentInfo {
5963
#if os(macOS) || targetEnvironment(macCatalyst)
6064
let os = ProcessInfo.processInfo.operatingSystemVersion
6165
return "\(os.majorVersion).\(os.minorVersion).\(os.patchVersion)"
62-
#elseif os(iOS)
66+
#elseif os(iOS) || os(tvOS) || os(visionOS)
6367
UIDevice.current.systemVersion
6468
#elseif os(watchOS)
6569
WKInterfaceDevice.current().systemVersion
66-
#elseif os(tvOS)
67-
UIDevice.current.systemVersion
6870
#else
6971
""
7072
#endif

0 commit comments

Comments
 (0)