<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSViewController/extensionContext",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSViewController(py)extensionContext"
  },
  "title" : "extensionContext"
}
-->

# extensionContext

For a view controller that is part of an app extension, the app extension context.

```
var extensionContext: NSExtensionContext? { get }
```

## Discussion

If the view controller is *not* part of an app extension, the value of this property is `nil`.

By checking for `nil` you can employ this method to determine whether the view controller is part of an app or an app extension, for the purpose of conditionalizing your view controller implementation. Refer to <doc://com.apple.documentation/documentation/Foundation/NSExtensionContext> for information about the extension context.

---

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)