Skip to content

Commit d41a530

Browse files
committed
adhere to macCatalyst
1 parent 3c3174c commit d41a530

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Sources/Helpers/Version.swift

+16-4
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,21 @@ private let _version = "2.26.0" // {x-release-please-version}
1212
private let _platform: String? = {
1313
#if os(macOS)
1414
return "macOS"
15+
#elseif os(visionOS)
16+
return "visionOS"
1517
#elseif os(iOS)
16-
return "iOS"
17-
#elseif os(tvOS)
18-
return "tvOS"
18+
#if targetEnvironment(macCatalyst)
19+
return "macCatalyst"
20+
#else
21+
if #available(iOS 14.0, *), ProcessInfo.processInfo.isiOSAppOnMac {
22+
return "iOSAppOnMac"
23+
}
24+
return "iOS"
25+
#endif
1926
#elseif os(watchOS)
2027
return "watchOS"
28+
#elseif os(tvOS)
29+
return "tvOS"
2130
#elseif os(Android)
2231
return "Android"
2332
#elseif os(Linux)
@@ -31,7 +40,10 @@ private let _platform: String? = {
3140

3241
private let _platformVersion: String? = {
3342
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Windows)
34-
ProcessInfo.processInfo.operatingSystemVersionString
43+
let majorVersion = ProcessInfo.processInfo.operatingSystemVersion.majorVersion
44+
let minorVersion = ProcessInfo.processInfo.operatingSystemVersion.minorVersion
45+
let patchVersion = ProcessInfo.processInfo.operatingSystemVersion.patchVersion
46+
return "\(majorVersion).\(minorVersion).\(patchVersion)"
3547
#elseif os(Linux) || os(Android)
3648
if let version = try? String(contentsOfFile: "/proc/version") {
3749
version.trimmingCharacters(in: .whitespacesAndNewlines)

0 commit comments

Comments
 (0)