An instance of NSPointerFunctions defines callout functions appropriate for managing a pointer reference held somewhere else.


class NSPointerFunctions : NSObject


The functions specified by an instance of NSPointerFunctions are separated into two clusters—those that define “personality” such as “object” or "C-string”, and those that describe memory management issues such as a memory deallocation function. There are constants for common personalities and memory manager selections (see Memory and Personality Options).

NSHashTable, NSMapTable, and NSPointerArray use an NSPointerFunctions object to define the acquisition and retention behavior for the pointers they manage. Note, however, that not all combinations of personality and memory management behavior are valid for these collections. The pointer collection objects copy the NSPointerFunctions object on input and output, so you cannot usefully subclass NSPointerFunctions.

Subclassing Notes

NSPointerFunctions is not suitable for subclassing.


Creating and Initializing an NSPointerFunctions Object

init(options: NSPointerFunctions.Options)

Returns an NSPointerFunctions object initialized with the given options.

Memory Configuration

var usesStrongWriteBarrier: Bool

Specifies whether, in a garbage collected environment, pointers should be assigned using a strong write barrier.

var usesWeakReadAndWriteBarriers: Bool

Specifies whether, in a garbage collected environment, pointers should use weak read and write barriers.



struct NSPointerFunctions.Options

Defines the memory and personality options for an NSPointerFunctions object.


Inherits From

See Also

Getting the Pointer Functions

var pointerFunctions: NSPointerFunctions

The functions in use by the receiver.