<!--
{
  "availability" : [
    "iOS: 9.0.0 - 15.0.0",
    "iPadOS: 9.0.0 - 15.0.0",
    "macCatalyst: 13.1.0 - 15.0.0",
    "macOS: 10.0.0 - 12.0.0",
    "tvOS: 9.0.0 - 15.0.0",
    "visionOS: 1.0.0 - 1.0.0",
    "watchOS: 2.0.0 - 8.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGColorSpace/init(platformColorSpaceRef:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Graphics",
      "CoreGraphics"
    ],
    "preciseIdentifier" : "c:@F@CGColorSpaceCreateWithPlatformColorSpace"
  },
  "title" : "init(platformColorSpaceRef:)"
}
-->

# init(platformColorSpaceRef:)

Creates a platform-specific color space.

```
init?(platformColorSpaceRef ref: UnsafeRawPointer)
```

## Parameters

`ref`

A generic pointer to a platform-specific color space. In macOS, pass a `ColorSyncProfileRef`, which is a ColorSync profile. Quartz uses this pointer (and the underlying information) only during the function call.

## Return Value

A new color space, or `NULL` if unsuccessful. In Objective-C, you’re responsible for releasing this object by calling [`CGColorSpaceRelease`](/documentation/CoreGraphics/CGColorSpaceRelease).

## Discussion

Colors in a device-dependent color space are not transformed or otherwise modified when displayed on an output device — that is, there is no attempt to maintain the visual appearance of a color. As a consequence, colors in a device color space often appear different when displayed on different output devices. For this reason, device color spaces are not recommended when color preservation is important.

---

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)