---
title: main
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/bundle/main
---

# main

Returns the bundle object that contains the current executable.

## Declaration

```swift
class var main: Bundle { get }
```

## Return Value

Return Value The NSBundle object corresponding to the bundle directory that contains the current executable. This method may return a valid bundle object even for unbundled apps. It may also return nil if the bundle object could not be created, so always check the return value.

## Discussion

Discussion The main bundle lets you access the resources in the same directory as the currently running executable. For a running app or code running in a framework, the main bundle offers access to the app’s bundle directory.

## See Also

### Related Documentation

- [Resource Programming Guide](apple-archive/documentation/Cocoa/Conceptual/LoadingResources/Introduction.md)
- [init(for:)](foundation/bundle/init(for:).md)
- [Bundle Programming Guide](apple-archive/documentation/CoreFoundation/Conceptual/CFBundles/Introduction.md)

### Getting standard bundle objects

- [allFrameworks](foundation/bundle/allframeworks.md)
- [allBundles](foundation/bundle/allbundles.md)
