I have a growing collection of files in my Swift project which I want to organise better. This includes a folder of sounds, a few font files and my Localizable.strings
file.
I also have a Resources folder which is empty, because every time I move a file into it the project can’t find it any more and the application bombs.
For example, when referencing a sound file, I can use Bundle.main.path(forResource: "thing", ofType: "mp3")!
which finds it in my Sounds
folder at the root level, but not if I move it into the Resources
folder. Ditto the font files, and I haven’t had the courage to try my strings file.
What is the trick to moving files into subfolders?
Edit:
Somebody decided that this was answered in Swift - How do I get the file path inside a folder. Well, no, but the accepted answer did at least point me to inDirectory
which is the new name for subdirectory
; I included Resources/Sounds
and it works.
However, it doesn’t answer the question of the font files.