<!--
{
  "availability" : [
    "macCatalyst: 13.1.0 - 13.1.0"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGDisplaySwitchToMode(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGDisplaySwitchToMode"
  },
  "title" : "CGDisplaySwitchToMode(_:_:)"
}
-->

# CGDisplaySwitchToMode(_:_:)

Switches a display to a different mode.

```
func CGDisplaySwitchToMode(_ display: CGDirectDisplayID, _ mode: CFDictionary?) -> CGError
```

## Parameters

`display`

The identifier of the display to be accessed.

`mode`

A display mode dictionary that contains information about the display mode to set. The dictionary passed in must be a dictionary returned by another Quartz display function such as [`CGDisplayAvailableModes(_:)`](/documentation/CoreGraphics/CGDisplayAvailableModes(_:)) or [`CGDisplayBestModeForParameters(_:_:_:_:_:)`](/documentation/CoreGraphics/CGDisplayBestModeForParameters(_:_:_:_:_:)). For a list of the properties in a display mode dictionary, see [Display Mode Standard Properties](/documentation/CoreGraphics/display-mode-standard-properties) and [Display Mode Optional Properties](/documentation/CoreGraphics/display-mode-optional-properties). For general information about using dictionaries, see <doc://com.apple.documentation/documentation/CoreFoundation/CFDictionary>.

## Return Value

A result code. See `Core Graphics Data Types and Constants`.

## Discussion

This function switches the display mode of the specified display. The operation is always synchronous; the function does not return until the mode switch is complete. Note that after switching, display parameters and addresses may change.

The selected display mode persists for the life of the calling program. When the program terminates, the display mode automatically reverts to the permanent setting in the Displays panel of System Preferences.

When changing the display mode of a display in a mirroring set, other displays in the mirroring set will be assigned a mode that’s capable of mirroring the bounds of the display being adjusted. To avoid this automatic behavior, you can use the following procedure: call[`CGBeginDisplayConfiguration(_:)`](/documentation/CoreGraphics/CGBeginDisplayConfiguration(_:)), call [`CGConfigureDisplayMode(_:_:_:)`](/documentation/CoreGraphics/CGConfigureDisplayMode(_:_:_:)) for each display to explicitly set the mode, and finally call [`CGCompleteDisplayConfiguration(_:_:)`](/documentation/CoreGraphics/CGCompleteDisplayConfiguration(_:_:))

### Special Considerations

This deprecated function takes as a parameter a display mode dictionary. Starting in OS X v10.6, display mode dictionaries have been replaced by the `CGDisplayMode` opaque type.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)