Detect macOS Catalyst (#8)

* Detect macOS Catalyst

It is currently reported as iOS, which in some technical senses is
somewhat true - but does not fully capture the semantics of where
the app is actually run (which is on a Mac running macOS).

* Increase minimum Swift version to 5.6

Needed to support "targetEnvironment" to detect macOS Catalyst.

* Report OS name as "macOS"
This commit is contained in:
Aron Manucheri
2023-10-01 10:39:30 +02:00
committed by GitHub
parent 996859a5b7
commit 0e867245a2
3 changed files with 4 additions and 4 deletions

View File

@@ -10,6 +10,6 @@ Pod::Spec.new do |s|
s.osx.deployment_target = "10.15"
s.watchos.deployment_target = "6.0"
s.tvos.deployment_target = "13.0"
s.swift_version = '5.5'
s.swift_version = '5.6'
s.source_files = 'Sources/Aptabase/**/*'
end

View File

@@ -1,4 +1,4 @@
// swift-tools-version: 5.5
// swift-tools-version: 5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription

View File

@@ -39,7 +39,7 @@ struct EnvironmentInfo {
}
private static var osName: String {
#if os(macOS)
#if os(macOS) || targetEnvironment(macCatalyst)
"macOS"
#elseif os(iOS)
if UIDevice.current.userInterfaceIdiom == .pad {
@@ -56,7 +56,7 @@ struct EnvironmentInfo {
}
private static var osVersion: String {
#if os(macOS)
#if os(macOS) || targetEnvironment(macCatalyst)
let os = ProcessInfo.processInfo.operatingSystemVersion
return "\(os.majorVersion).\(os.minorVersion).\(os.patchVersion)"
#elseif os(iOS)