Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ let package = Package(
platforms: [
.iOS(.v9),
.tvOS(.v9),
.watchOS(.v2)
.watchOS(.v2),
.macOS(.v10_14)
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
Expand Down
36 changes: 30 additions & 6 deletions Source/Device.generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@

#if os(watchOS)
import WatchKit
#else
#elseif os(iOS)
import UIKit
#else
import AppKit
#endif

// MARK: Device
Expand Down Expand Up @@ -506,6 +508,8 @@ public enum Device {
case "i386", "x86_64", "arm64": return simulator(mapToDevice(identifier: ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] ?? "watchOS"))
default: return unknown(identifier)
}
#elseif os(macOS)
return unknown(identifier)
#endif
}

Expand Down Expand Up @@ -711,6 +715,8 @@ public enum Device {
}
#elseif os(tvOS)
return (width: -1, height: -1)
#elseif os(macOS)
return (width: -1, height: -1)
#endif
}

Expand Down Expand Up @@ -952,6 +958,8 @@ public enum Device {
return allTVs
#elseif os(watchOS)
return allWatches
#elseif os(macOS)
return []
#endif
}

Expand Down Expand Up @@ -1005,8 +1013,10 @@ public enum Device {
guard isCurrent else { return nil }
#if os(watchOS)
return WKInterfaceDevice.current().name
#else
#elseif os(iOS)
return UIDevice.current.name
#else
return nil
#endif
}

Expand All @@ -1015,8 +1025,10 @@ public enum Device {
guard isCurrent else { return nil }
#if os(watchOS)
return WKInterfaceDevice.current().systemName
#else
#elseif os(iOS)
return UIDevice.current.systemName
#else
return nil
#endif
}

Expand All @@ -1025,8 +1037,10 @@ public enum Device {
guard isCurrent else { return nil }
#if os(watchOS)
return WKInterfaceDevice.current().systemVersion
#else
#elseif os(iOS)
return UIDevice.current.systemVersion
#else
return nil
#endif
}

Expand All @@ -1035,8 +1049,10 @@ public enum Device {
guard isCurrent else { return nil }
#if os(watchOS)
return WKInterfaceDevice.current().model
#else
#elseif os(iOS)
return UIDevice.current.model
#else
return nil
#endif
}

Expand All @@ -1045,8 +1061,10 @@ public enum Device {
guard isCurrent else { return nil }
#if os(watchOS)
return WKInterfaceDevice.current().localizedModel
#else
#elseif os(iOS)
return UIDevice.current.localizedModel
#else
return nil
#endif
}

Expand Down Expand Up @@ -1142,6 +1160,8 @@ public enum Device {
}
#elseif os(tvOS)
return nil
#elseif os(macOS)
return nil
#endif
}

Expand Down Expand Up @@ -1269,6 +1289,8 @@ extension Device: CustomStringConvertible {
case .simulator(let model): return "Simulator (\(model.description))"
case .unknown(let identifier): return identifier
}
#elseif os(macOS)
return "macOS"
#endif
}

Expand Down Expand Up @@ -1373,6 +1395,8 @@ extension Device: CustomStringConvertible {
case .simulator(let model): return "Simulator (\(model.safeDescription))"
case .unknown(let identifier): return identifier
}
#elseif os(macOS)
return "macOS"
#endif
}

Expand Down