Class

NSScreen

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

Overview

An app 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 app 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 app with Xcode, the application object is automatically created for you during initialization.

Topics

Getting Screen Objects

class var main: NSScreen?

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

class var deepest: NSScreen?

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

class var screens: [NSScreen]

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

Getting Screen Information

var depth: NSWindow.Depth

The current bit depth and colorspace information of the screen.

var frame: NSRect

The dimensions and location of the screen.

var supportedWindowDepths: UnsafePointer<NSWindow.Depth>

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

var deviceDescription: [NSDeviceDescriptionKey : 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 var screensHaveSeparateSpaces: Bool

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.

Notifications

class let colorSpaceDidChangeNotification: NSNotification.Name

Posted when the color space of the screen has changed.

Relationships

Inherits From

Conforms To

See Also

Screens

func NSDisableScreenUpdates()

Disables screen updates.

func NSEnableScreenUpdates()

Enables screen updates.