# Swift and Xcode

Build and test Swift packages and Xcode applications alongside the rest of your workspace.


Bring Swift packages, Xcode projects, and Xcode workspaces into the Nx project graph. Keep using your existing Swift and Xcode files; Megamono discovers the projects and connects local dependencies.

## Add to your workspace

Check the [Node.js and Nx requirements](/docs/workflows/requirements#platform-plugins) for this plugin before installing.

Install `@megamono/nx-apple` as a development dependency using your workspace's package manager. Merge this entry into the existing `plugins` list in `nx.json`:

```json
{
  "plugins": [
    "@megamono/nx-apple"
  ]
}
```

Run `npm exec -- nx show projects` to find your project, then `npm exec -- nx show project <project>` to see its tasks. Replace `<project>` with the name from the list.

## Build and test

Install the Swift toolchain; Xcode application builds require macOS and Xcode. Swift packages receive build and test targets. Xcode projects need a shared scheme: a single shared scheme is selected automatically; configure `scheme` when there is more than one.

Set `configuration` and `destination` in the plugin options to select the build configuration and device or simulator. A SwiftLint target is added when a SwiftLint configuration exists.

## Create a macOS application

Use the [Apple application generator](/docs/generators/nx-apple-application) to create a SwiftUI app. Configure signing and test on your intended devices before distributing it.
