Instance Method

completeRequest(returningItems:completionHandler:)

Tells the host app to complete the app extension request with an array of result items.

Declaration

func completeRequest(returningItems items: [Any]?, completionHandler: ((Bool) -> Void)? = nil)

Parameters

items

An array of result items, each an NSExtensionItem object, to return to the host app.

completionHandler

An optional block to be called when the request completes, performed as a background priority task.

The block takes the following parameter:

expired

A Boolean value that indicates whether the system is terminating a previous invocation of the completionHandler block.

This parameter is true when the system prematurely terminates a completionHandler block that was previously invoked and had not otherwise expired.

Discussion

Calling this method eventually dismisses the app extension’s view controller.

See Also

Handling Requests

func cancelRequest(withError: Error)

Tells the host app to cancel the app extension request, with a supplied error.