Instance PropertyConcurrency

result

The result or error from a throwing task, after it completes.

  • Available when Success conforms to Sendable and Failure conforms to Error

  • iOS 13.0+
  • macOS 10.15+
  • tvOS 13.0+
  • watchOS 6.0+
var result: Result<Success, Failure> { get async }

Returns

If the task succeeded, .success with the task’s result as the associated value; otherwise, .failure with the error as the associated value.

Overview

If the task hasn’t completed, accessing this property waits for it to complete and its priority increases to that of the current task. Note that this might not be as effective as creating the task with the correct priority, depending on the executor’s scheduling details.