withUnsafeMutablePointer

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

Calls the given closure with a mutable pointer to the given argument.

The withUnsafeMutablePointer(to:_:) function is useful for calling Objective-C APIs that take in/out parameters (and default-constructible out parameters) by pointer.

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