Type Alias


Callback invoked to process a message received on a CFMessagePort object.


typealias CFMessagePortCallBack = (CFMessagePort?, Int32, CFData?, UnsafeMutableRawPointer?) -> Unmanaged<CFData>?



The local message port that received the message.


An arbitrary integer value assigned to the message by the sender.


The message data.


The info member of the CFMessagePortContext structure that was used when creating local.

Return Value

Data to send back to the sender of the message. The system releases the returned CFData object. Return NULL if you want an empty reply returned to the sender.


If you want the message data to persist beyond this callback, you must explicitly create a copy of data rather than merely retain it; the contents of data will be deallocated after the callback exits.

See Also


typealias CFMessagePortInvalidationCallBack

Callback invoked when a CFMessagePort object is invalidated.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software