mirror of
https://github.com/yattee/yattee.git
synced 2026-02-20 01:39:46 +00:00
Yattee v2 rewrite
This commit is contained in:
48
Yattee/Models/PlayerControls/DeviceClass.swift
Normal file
48
Yattee/Models/PlayerControls/DeviceClass.swift
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// DeviceClass.swift
|
||||
// Yattee
|
||||
//
|
||||
// Device class for platform-specific layout sync.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Device class used for platform-specific layout sync.
|
||||
/// Layouts only sync between devices of the same class.
|
||||
enum DeviceClass: String, Codable, Hashable, Sendable {
|
||||
/// iPhone and iPad share iOS class.
|
||||
case iOS
|
||||
|
||||
/// macOS devices.
|
||||
case macOS
|
||||
|
||||
/// Apple TV devices.
|
||||
case tvOS
|
||||
|
||||
// MARK: - Current Device
|
||||
|
||||
/// The device class for the current platform.
|
||||
static var current: DeviceClass {
|
||||
#if os(iOS)
|
||||
return .iOS
|
||||
#elseif os(macOS)
|
||||
return .macOS
|
||||
#elseif os(tvOS)
|
||||
return .tvOS
|
||||
#endif
|
||||
}
|
||||
|
||||
// MARK: - Display
|
||||
|
||||
/// Localized display name for the device class.
|
||||
var displayName: String {
|
||||
switch self {
|
||||
case .iOS:
|
||||
return "iOS"
|
||||
case .macOS:
|
||||
return "macOS"
|
||||
case .tvOS:
|
||||
return "tvOS"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user