Limit available controls layout

This commit is contained in:
Arkadiusz Fal
2022-08-29 14:41:21 +02:00
parent 9419d504dc
commit 66506c6ad1
2 changed files with 36 additions and 3 deletions

View File

@@ -1,5 +1,8 @@
import Defaults
import Foundation
#if os(iOS)
import UIKit
#endif
enum PlayerControlsLayout: String, CaseIterable, Defaults.Serializable {
case tvRegular
@@ -9,6 +12,36 @@ enum PlayerControlsLayout: String, CaseIterable, Defaults.Serializable {
case small
case smaller
var available: Bool {
var isATV = false
var isIPad = false
#if os(tvOS)
isATV = true
#endif
#if os(iOS)
isIPad = UIDevice.current.userInterfaceIdiom == .pad
#endif
switch self {
case .tvRegular:
return isATV
case .veryLarge:
#if os(macOS)
return true
#else
return isIPad
#endif
case .large:
return true
case .medium:
return true
case .small:
return true
case .smaller:
return true
}
}
var description: String {
switch self {
case .tvRegular: