---
title: preflight()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/bundle/preflight()
---

# preflight()

Returns a Boolean value indicating whether the bundle’s executable code could be loaded successfully.

## Declaration

```swift
func preflight() throws
```

## Discussion

Discussion This method does not actually load the bundle’s executable code. Instead, it performs several checks to see if the code could be loaded and with one exception returns the same errors that would occur during an actual load operation. The one exception is the NSExecutableLinkError error, which requires the actual loading of the code to verify link errors. For a list of possible load errors, see the discussion for the loadAndReturnError() method. note: In Swift, this method returns Void and is marked with the throws keyword to indicate that it throws an error in cases of failure. You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.

## See Also

### Loading code from a bundle

- [executableArchitectures](foundation/bundle/executablearchitectures.md)
- [load()](foundation/bundle/load().md)
- [loadAndReturnError()](foundation/bundle/loadandreturnerror().md)
- [unload()](foundation/bundle/unload().md)
- [isLoaded](foundation/bundle/isloaded.md)
- [Mach-O Architecture](foundation/1495005-mach-o-architecture.md)
