## TL;DR

Danger-swift compiles your Dangerfile against an Xcode project, and it is looking in the wrong place. Either pass the project explicitly with `--project [path/to/Project.xcodeproj]` or run the job from the directory that actually contains the `.xcodeproj`. If the repo is Swift Package Manager only and has no xcodeproj by design, the classic danger-swift setup does not fit and you need a different approach.

## The error

```text
danger-swift ci
Error: could not find xcodeproj in the working directory
```

## Fix it

1. Verify what exists. List the repo root and search for `.xcodeproj` or `.xcworkspace` files.
   Expected: you either find the project file (and see it is somewhere unexpected) or confirm the repo genuinely has none.
2. If the project exists but elsewhere, point danger-swift at it explicitly: run `danger-swift ci --project [path/to/Project.xcodeproj]`.
   Expected: danger-swift builds the Dangerfile against that project instead of searching the working directory.
3. If the CI job runs in a subdirectory, set the job's working directory to the repo root (or cd there before invoking danger-swift).
   Expected: the project is found without needing the flag.
4. If the repo is Swift Package Manager only with no xcodeproj by design, decide deliberately: generate an xcodeproj for Danger's sake, or reconsider whether danger-swift is the right bot for this repo.
   Expected: a setup choice the team made on purpose, not an error you keep hitting.
5. Re-run the Danger job.
   Expected: Danger posts its review comments on the PR instead of erroring.

## Use this when

- danger-swift errors with "could not find xcodeproj"
- The Danger review bot is misconfigured and never posts
- Dangerfile.swift will not build in CI but works (or was never tried) locally

## Not for this skill when

- Danger fails inside your Dangerfile logic (a Swift error in your own rules) - that is a code bug, not a project lookup problem
- You are using danger-js or danger-ruby instead of danger-swift - different setup, different fixes
- The error is a missing API credential for posting comments - that is an auth problem, not a project problem

## Variant phrasings

- danger-swift could not find xcodeproj
- danger swift no xcodeproj
- danger-swift ci fails
- danger review bot misconfigured

## Why it happens

Danger-swift needs an Xcode project to compile `Dangerfile.swift` against - the project provides the build settings and module context. When the working directory has no `.xcodeproj`, the build has nothing to target and the run aborts before any review logic executes. Monorepos and SPM-only repos hit this constantly because the project file is not where the tool assumes.

## Edge cases

- Workspaces vs projects: point at the `.xcworkspace` when the project expects one, or the build resolves the wrong schemes
- danger-swift version vs Swift toolchain mismatches produce cryptic build failures that look like config problems - check the versions first
- Reproduce locally with the same command CI runs; environment differences hide in CI logs
- If Danger runs on a schedule instead of per-PR, a broken setup fails silently for weeks - check the job history, not just the latest run

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_O3H99VFZ-Ts319bCsOj93A
