edit: Oops! I just realized I posted this in the wrong chapter. I was working on chapter 20’s challenge
I was relieved to have a more straightforward challenge this chapter, however I noticed something when creating the new class. When I created the subclass this time Xcode put it in a sub-folder with main.m (see image below) instead of the top level like when I created the BNRStockholding class (or like with the BMITime program). Everything seemed to compile and work fine this way, my question is simply why was it created here instead of at the top level like before and is it just a matter of personal organization preference or are there issue that could arise from putting your class files in the wrong location?
Thanks!
The navigation bar is completely aesthetic. The way it’s compiled eventually has nothing to do with the way you organise it in there. You can add as many folders and re-arrange and move them any way you like.
As you discovered, it matters what you have selected in the Navigator when you create a new file. In your example, you had the Project selected at the top of the Navigator (the top-level item with the blueprint icon). When XCode created the new files it placed them in the same directory location as the Project file, which is one level above the project files themselves.
From a visual standpoint you could drag them from the upper level into the Project folder in Navigator. HOWEVER, this just places a reference to them there from an organizational standpoint and DOES NOT ACTUALLY MOVE THEM. If you move them in Finder then you will break the reference to them in the XCode project and have to fix that.
So, when you go to create new file make sure you’re paying attention to where those files are going to be created.
Mark H