Writes the bytes of a property list serialization out to a stream.


func CFPropertyListWriteToStream(_ propertyList: CFPropertyList!, _ stream: CFWriteStream!, _ format: CFPropertyListFormat, _ errorString: UnsafeMutablePointer<Unmanaged<CFString>?>!) -> CFIndex



The property list to write out.


The stream to write to. The stream must be opened and configured—this function simply writes bytes to the stream.


A constant that specifies the format used to write propertyList. See CFPropertyListFormat for possible values.


On return, NULL if the conversion is successful, otherwise a string that describes the nature of the errors. Error messages are not localized, but may be in the future, so they are not currently suitable for comparison.

Pass NULL if you do not wish to receive an error string. Ownership follows the The Create Rule.

Return Value

The number of bytes written, or 0 if an error occurred. If 0 is returned, errorString will contain an error message.


This function leaves the stream open after reading the content. When reading a property list, this function expects the reading stream to end wherever the writing ended, so that the end of the property list data can be identified.

Special Considerations

See Also

Exporting a Property List