<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Operation/isCancelled",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSOperation(py)cancelled"
  },
  "title" : "isCancelled"
}
-->

# isCancelled

A Boolean value indicating whether the operation has been cancelled

```
var isCancelled: Bool { get }
```

## Discussion

The default value of this property is <doc://com.apple.documentation/documentation/Swift/false>. Calling the [`cancel()`](/documentation/Foundation/Operation/cancel()) method of this object sets the value of this property to <doc://com.apple.documentation/documentation/Swift/true>. Once canceled, an operation must move to the finished state.

Canceling an operation does not actively stop the receiver’s code from executing. An operation object is responsible for calling this method periodically and stopping itself if the method returns <doc://com.apple.documentation/documentation/Swift/true>.

You should always check the value of this property before doing any work towards accomplishing the operation’s task, which typically means checking it at the beginning of your custom [`main()`](/documentation/Foundation/Operation/main()) method. It is possible for an operation to be cancelled before it begins executing or at any time while it is executing. Therefore, checking the value at the beginning of your [`main()`](/documentation/Foundation/Operation/main()) method (and periodically throughout that method) lets you exit as quickly as possible when an operation is cancelled.

## See Also

[`cancel()`](/documentation/Foundation/Operation/cancel())

Advises the operation object that it should stop executing its task.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)