I've been fooling around with this and I lose "stuff"

I have an idea for an app for awhile (5+ years) and it took awhile (a year or more to figure out how to develop on - I know C/C++/FORTRAN, started in the punch card era). I ended up using the MacBook I had, some books and chatGPT and plunged into development. BTW this was all happening while I'm retired, included moving to FL from MD. There are times where development stops for months at a time, I've started and stopped at least four or five times on different portions of the project. I've realized that I can actually skip the user interface until the end if ever.

At the beginning of code development, I did little more that "Hello world" programs to get my feet wet. Golf, pickleball, doctor appointments, etc. interrupts development. When I get back to it, my code has "disappeared", I open Xcode, open the project and I don't see any of my code - where did it go?

I did find the code using the Finder in Directory/projname/projname/ContentView.swift (I'm not sure why projname is duplicated, no doubt my ignorance!) - so the code is still present, somewhere!

Xcode uses a project file, and the filename is your project name with a .xcodeproj extension, e.g. MyApp.xcodeproj. That project file contains a link to the files you've added to or created within the project in Xcode.

Are the files still listed in the project viewer (the left-hand section of Xcode)?

If any of the files listed there are in red it means the files are in the project but Xcode can't find them. You might've moved them.

Given that you say the projname is duplicated, it's possible you've moved the files inside the projname folder into a new folder called projname inside that folder.

If the files are red, you can either drag the files from Finder back into Xcode and remove the red ones, or - and do this one at a time to see if it works - move one file from projname/projname/ into projname/. If it works, you can probably just move them all in one go.

I didn't explore the file structure much until recently. When I first started with programming on the Mac, I would start Xcode, go to File->New project, etc. I was having problems getting a start until I used ChatGPT to get started on how to program with Swift. Eventually I would stop, either by getting stuck or something else causes a pause (vacation, etc.).

Some number of months later, I would start again and I couldn't find my source code - where did it go? As I said before there were multiple parts, so I started on another part. I've had the same experience multiple times, I started thinking somebody was coming over the network and deleting files, so much so I found some USB sticks and I was just going to copy the project directories to those sticks.

Attached is a screen shot of what I see. readNumber (part of a method name), I was looking for the source...

The area on the left in grey is called the "navigator"

You've selected the Find navigator, and you expect to see files containing text containing "readNumber".

You're searching in an area called "macOS" (selected using the popup underneath the search field. I don't know what that is - it isn't one of the pre-defined search scopes. I usually use "in Project" or "in Project & SDK".

In addition, if you look at the bottom of the Find navigator, there's a file name filter. Your search doesn't find "readNumber" at all, so this doesn't make any difference here, but I have no idea where it is searching.

Clear the file filter at the bottom and change the search scope to "project" and see if it works then.

Also, select the Project navigator, expand the project view and post the screenshot - it should looks something like this

if it doesn't, maybe we'll be able to help you out.

Incidentally, clearly Xcode is finding something, because it built and ran your program. Also, if you're new to this, why are you building for both macOS and iOS? It would be easier to start with just one.

Apparently it is running (I see an icon on the bar), but I don't see a console (this is currently a console app using files, eventually).

I'm not sure it makes sense to start again - so far I have done that three or four times, each time I've stopped and then couldn't figure out to continue from where I was. What are the odds that would happen again. I need to read what you have written (I printed it out), and do some poking around.

(I was logged out - so I'm going to try and repeat what I just wrote....)

When I was going to create a new project I would create an empty directory, I didn't realize that Xcode did the same thing for probably the same reason.

I was looking around old projects, I found code under the Source Code Control Navigator(??), eventually I decided to start a new project ... again. I wonder what the Storyboard option under the interface list. That looks very similar to what I see when I'm looking for my code. Hmmm, I wonder if something switched the interface to Storyboard from SwiftUI? I wonder how I can switch it back?

I'm back - I've had Apple account password issues.

Maybe I need to find out more about the IDE!

I've been fooling around with this and I lose "stuff"
 
 
Q