I tried to add files to xcode 16 for loading a react build into webview by following this tutorial https://ditto.live/blog/run-react-locally-in-ios-app:
The Expected image should have been this
And when I try to list the build folder with:
let docsPath = Bundle.main.resourcePath!.appending("/build")
let fileManager = FileManager.default
do {
let docsArray = try fileManager.contentsOfDirectory(atPath: docsPath)
print(docsArray)
} catch {
print(error)
}
I get "No such file or directory" error in the console.
Xcode 16 has slightly changed the UI for adding files/folders.
The first checkbox in older versions, "Destination: Copy items if needed" is changed into a drop down list. Copy = checked; reference in place = unchecked; move is a newly added action that equals to copy then delete in the older version.
The "Add folders" radio buttons group is changed into a drop down list as well. It only appears when you are adding a folder from disk. The options remain the same.
To debug file path related issues, one way is to use Xcode > Product > Show Build Folder In Finder, and reveal the content in the app bundle to see how the folders are actually structured in the bundle.
In short, "groups" are logic groupings for the project files only, and all the files are laid flat in the root level of the bundle; "folder references" are actual folders created in the bundle so the files are hierarchical.
Related Apple doc: https://developer.apple.com/documentation/xcode/managing-files-and-folders-in-your-xcode-project