withUnsafePointer

func withUnsafePointer(to:_:)(to value: T, _ body: (UnsafePointer<T>) throws -> Result) rethrows -> Result

Invokes the given closure with a pointer to the given argument.

The withUnsafePointer(to:_:) function is useful for calling Objective-C APIs that take in parameters by const pointer.

The pointer argument to body is valid only during the execution of withUnsafePointer(to:_:). Do not store or return the pointer for later use.

func withUnsafePointer(to:_:)(to value: inout T, _ body: (UnsafePointer<T>) throws -> Result) rethrows -> Result

Invokes the given closure with a pointer to the given argument.

The withUnsafePointer(to:_:) function is useful for calling Objective-C APIs that take in parameters by const pointer.

The pointer argument to body is valid only during the execution of withUnsafePointer(to:_:). Do not store or return the pointer for later use.