UIDevice.currentDevice static property
The UIDevice.currentDevice static property is the device the app is running on.
Value
UIDevice.
- Read-only. Assigning to it throws
TypeError. - Every read returns the same object.
UIDevicecan't be created withnew; this is the only way to get the instance.new UIDevice()throwsTypeError: Illegal constructor: UIDevice is created by the runtime, not by new.
Examples
js
const current = UIDevice.currentDevice;
console.log(current === UIDevice.currentDevice);Result: Prints true.
Corresponding iOS API
UIDevice.currentDevice.