Zum Inhalt

apple/PhysarumApp/Sources/Model/DeviceIdiom.swift

import Foundation
#if os(iOS)
import UIKit
#endif

/// Device class for live-path workload + capture-ceiling decisions.
enum DeviceIdiom: Equatable { case phone, pad, mac, tv }

/// The running device's class. iPad is its own class (not "desktop").
var currentDeviceIdiom: DeviceIdiom {
    #if os(macOS)
    return .mac
    #elseif os(tvOS)
    return .tv
    #else
    return UIDevice.current.userInterfaceIdiom == .pad ? .pad : .phone
    #endif
}