---
title: extensionContext
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsviewcontroller/extensioncontext
---

# extensionContext

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

## Declaration

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

## Discussion

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 NSExtensionContext for information about the extension context.

## See Also

### Configuring an App Extension View Controller

- [preferredScreenOrigin](appkit/nsviewcontroller/preferredscreenorigin.md)
- [preferredMaximumSize](appkit/nsviewcontroller/preferredmaximumsize.md)
- [preferredMinimumSize](appkit/nsviewcontroller/preferredminimumsize.md)
- [viewWillTransition(to:)](appkit/nsviewcontroller/viewwilltransition(to:).md)
- [sourceItemView](appkit/nsviewcontroller/sourceitemview.md)
