---
title: shared
framework: appkit
role: symbol
role_heading: Type Property
path: appkit/nsapplication/shared
---

# shared

Returns the application instance, creating it if it doesn’t exist yet.

## Declaration

```swift
class var shared: NSApplication { get }
```

## Mentioned in

Passing control from one app to another with cooperative activation

## Return Value

Return Value The shared application object.

## Discussion

Discussion This method also makes a connection to the window server and completes other initialization. Your program should invoke this method as one of the first statements in main(); this invoking is done for you if you create your application with Xcode. To retrieve the NSApplication instance after it has been created, use the global variable NSApp or invoke this method.

## See Also

### Related Documentation

- [run()](appkit/nsapplication/run().md)
- [terminate(_:)](appkit/nsapplication/terminate(_:).md)

### Getting the shared app object

- [NSApp](appkit/nsapp.md)
