An object that describes the attributes of a computer’s monitor or screen.


An application may use an NSScreen object to retrieve information about a screen and use this information to decide what to display upon that screen. For example, an application may use the deepest() method to find out which of the available screens can best represent color and then may choose to display all of its windows on that screen.

The application object should be created before you use the methods in this class, so that the application object can make the necessary connection to the window system. You can make sure the application object exists by invoking the shared() method of NSApplication. If you created your application with Xcode, the application object is automatically created for you during initialization.


Getting Screen Objects

class func main()

Returns the screen object containing the window with the keyboard focus.

class func deepest()

Returns a screen object representing the screen that can best represent color.

class func screens()

Returns an array of screen objects representing all of the screens available on the system.

Getting Screen Information

var depth: NSWindowDepth

The current bit depth and colorspace information of the screen.

var frame: NSRect

The dimensions and location of the screen.

var supportedWindowDepths: UnsafePointer<NSWindowDepth>

A zero-terminated array of the window depths supported by the screen.

var deviceDescription: [String : Any]

The device dictionary for the screen.

var visibleFrame: NSRect

The current location and dimensions of the visible screen.

var colorSpace: NSColorSpace?

The color space of the screen.

func canRepresent(NSDisplayGamut)

A Boolean value indicating whether the color space of the screen is capable of representing the specified display gamut.

class func screensHaveSeparateSpaces()

Returns a Boolean value indicating whether each screen can have its own set of spaces.

Screen Backing Coordinate Conversion

func backingAlignedRect(NSRect, options: AlignmentOptions = [])

Converts a rectangle in global screen coordinates to a pixel aligned rectangle.

var backingScaleFactor: CGFloat

The backing store pixel scale factor for the screen.

func convertRectFromBacking(NSRect)

Converts the rectangle from the device pixel aligned coordinates system of a screen.

func convertRectToBacking(NSRect)

Converts the rectangle to the device pixel aligned coordinates system of a screen.

Extended Dynamic Range

var maximumExtendedDynamicRangeColorComponentValue: CGFloat

The current maximum color component value for the screen.


static let NSScreenColorSpaceDidChange: NSNotification.Name

Posted when the color space of the screen has changed.


Inherits From

Conforms To