Type Alias VNRequestCompletionHandler

Source
pub type VNRequestCompletionHandler = *mut DynBlock<dyn Fn(NonNull<VNRequest>, *mut NSError)>;
Available on crate features VNRequest and block2 only.
Expand description

A block that is executed at the completion of a request.

The completion handler is called for each request when it is finished processing, before the performRequests call returns. When an array of multiple requests is executed with one performRequests call, each request’s completion handler is invoked when that request has finished its processing. This invocation may therefore occur while other requests in the array are either still executing or waiting for execution. This allows, for example, UI to be updated while the first tasks are complete instead of having to wait that all requests have to finish. Note, however, that performRequests is not an asynchronous method, for which completion handlers are most typically used

Parameter request: The VNRequest that has been completed. The results of the request if no error was encountered are populated in the results array of the request.

Parameter error: The error that caused the request to fail, or nil if completed successfully.

See also Apple’s documentation