DeviceInfo
@MainActor
public struct DeviceInfo
Convenience type that may be used to access device info across different platforms.
Usage Example:
print(DeviceInfo.current.architecture) /* prints "x86_64", "arm64", or "unknown" */
- Tag: DeviceInfo
-
- Tag: DeviceInfo.current
Declaration
Swift
public static var current: DeviceInfo
-
Returns the name of the host or device
- Tag: DeviceInfo.name
Declaration
Swift
public var name: String { get }
-
Returns the name of the host
- Tag: DeviceInfo.hostName
Declaration
Swift
public var hostName: String { get }
-
Returns “x86_64”, “arm64”, or “unknown” depending on the architecture of the device.
- Tag: DeviceInfo.architecture
Declaration
Swift
public var architecture: String { get }
-
Returns the name of the model of the device
- Tag: DeviceInfo.model
Declaration
Swift
public var model: String { get }
-
Returns a tuple with the name of the operating system, e.g. “watchOS”, “iOS”, or “macOS” and its semantic version number
- Tag: DeviceInfo.operatingSystem
Declaration
Swift
public var operatingSystem: (name: String, version: String) { get }
-
If available, returns the unique identifier for the device
- Tag: DeviceInfo.identifierForVendor
Declaration
Swift
public var identifierForVendor: UUID? { get }
-
Returns the bounding rect of the main screen of the device
- Tag: DeviceInfo.screenBounds
Declaration
Swift
public var screenBounds: CGRect { get }