One Logo Pool Ball
CoreVideo · IOS API REFERENCE

CVAttachmentValueRepresentable

protocol · iOS 27.0+ · SDK 27.1

protocol CVAttachmentValueRepresentable

Allows Swift types to be used as buffer attachment value. A type conforming to this protocol can be used as value for an attachment key. The ``CVAttachmentRawValue`` type facilitates conversion to and from raw attachment values. Conformances of standard Swift type to this protocol are provided in CoreVideo framework. Implementing this protocol for a custom struct is as simple as: ```swift struct MyStruct { var number: Int var tags: [String] } extension MyStruct: CVAttachmentValueRepresentable { static func makeFromRawAttachmentValue(_ repr: CVAttachmentRawValue) -> Self? { guard let number: Int = repr["number"], tags: [String] = repr["tags"] else { return nil } return .init(number: number, tags: tags) } var rawAttachmentValueRepresentation: CVAttachmentRawValue { ["number": self.number, "tags": self.tags] } } ``` Default implementation is provided for ``RawRepresentable`` protocol where RawValue conforms to this protocol. This allow enumeration with raw values to conform to ``CVAttachmentValueRepresentable`` protocol without a custom implementation.

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

No declarations were skipped in this snapshot.

All CoreVideo types →