-2

When I click on a folder in the Navigation pane, and open it in Finder, the file is there, but it's not shown in Xcode and build fails complaining the file doesn't exist. Is there a way to "Refresh" the file structure (the way you would in IntelliJ) or can I only do a drag*drop to fix it?

Cœur
  • 37,241
  • 25
  • 195
  • 267
matchifang
  • 5,190
  • 12
  • 47
  • 76
  • 3
    The Navigation pane file structure and the Finder file structure do not match. Dragging and dropping files in the Finder is not a way to add items to your project. – Magnas Jan 30 '19 at 13:09
  • Also, back in the days of Xcode 9 beta I found that dragging/dropping files from Finder into the Xcode Navigation Pane didn't always work. (It's probably fixed now, but certain file types may still not always work.) Try deleting the file reference in Xcode then adding it back into your project via `File | Add Files To`. –  Jan 30 '19 at 13:26

1 Answers1

2

When I click on a folder in the Navigation pane, and open it in Finder, the file is there, but it's not shown in Xcode and build fails complaining the file doesn't exist.

The project navigator doesn't show you the file system, it shows you the files included in the project. If you need to include a file in the project, then you'll need to add it. You can do that by dragging it into the project, or with the File->Add Files To "..." menu command.

Caleb
  • 124,013
  • 19
  • 183
  • 272