Invokes the given closure with a pointer to the given argument.
- Xcode 8.0+
- Swift Standard Library
An instance to temporarily use via pointer.
A closure that takes a pointer to
argas its sole argument. If the closure has a return value, it is used as the return value of the
withfunction. The pointer argument is valid only for the duration of the function’s execution.
Unsafe Pointer(to: _:)
The return value of the
body closure, if any.
with 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
with. Do not store or return the pointer for later use.