Adding External Files to an Xcode Project

For years, this has been part of my workflow. I have a number of source (swift) files that I like to link into my projects. These are kept in their own directory. These files contain functionality that I share among projects for both Mac and iOS.

I include them in the project by right-clicking on the project folder in the project view in Xcode, and selecting "Add Files to ...". I then navigate to the folder containing the source files, click on the folder and select "Add." With the options "Create folder references" and "Add to target [target name]".

This always worked as advertised. The files lived in their original location but were compiled and linked into the target.

Then, along came Xcode 12. What's changed is that the files are no longer compiled into the target. I believe this is a bug and not an "enhancement." If it were the latter, then the option to add the files to the target would no longer appear.

Is there a workaround? And is this lack of functionality a new feature?
I tried what you described and found that Xcode 12 (12.3, actually) imports the folder as resources even if it contains .swift files.

You should better send a feedback soon.

Is there a workaround?

Until fixed, you may need to choose each source file when adding.
(Cmd-click or Cmd-A would work when choosing.)


UPDATE

Have you tried using Create Group instead of Create folder references?
You can change the Location of the Group to Absolute Path if you prefer.
Adding External Files to an Xcode Project
 
 
Q