<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreVideo",
  "identifier" : "/documentation/CoreVideo/CVMutablePixelBuffer/init(unsafeBacking:matching:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Video"
    ],
    "preciseIdentifier" : "s:9CoreVideo20CVMutablePixelBufferV13unsafeBacking8matchingACSo9IOSurfaceC_AA07CVPixelE18CreationAttributesVtKcfc"
  },
  "title" : "init(unsafeBacking:matching:)"
}
-->

# init(unsafeBacking:matching:)

Creates a CVPixelBuffer backed by the given `ioSurface`. The CVPixelBuffer will retain the `ioSurface`.
**IMPORTANT** If you are using IOSurface to share CVPixelBuffers between processes
and those CVPixelBuffers are allocated via a CVPixelBufferPool, it is important
that the CVPixelBufferPool does not reuse CVPixelBuffers whose IOSurfaces are still
in use in other processes.
CoreVideo and IOSurface will take care of this for if you use IOSurfaceCreateMachPort
and IOSurfaceLookupFromMachPort, but NOT if you pass IOSurfaceIDs.

```
init(unsafeBacking ioSurface: IOSurface, matching attributes: CVPixelBufferCreationAttributes) throws
```

---

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)