Newish developer scoping error question.

I'm coding an iPhone app using Swift and I'm getting this scoping error. Attached.

Please don't post screenshots of errors. They cannot be searched for, so if someone else has a similar issue and your post has the solution, they wouldn't be able to find it.

Now, to your issue...

I can see you have a file called MainView.swift, but there is no indication that there is a struct inside that file called MainView. Can you confirm the MainView struct exists? Do a search in Xcode for "struct MainView".

Alternatively, it might be that you have got the struct in that file but you've removed MainView.swift from the app target. To confirm this, select the file in the left-hand pane, then, in the Inspectors window on the right (not seen in your screenshot, so tap the "Hide or show the inspectors" button in the very top right of the Xcode window to show it). Select the first icon - it looks like a document - and look for the "Target Membership" section. If that area is empty, then it's not in your app, which is why the app cannot see the MainView struct. Add it with the plus button.

Secondly, and not related to your issue, your Services and Resources folders are within your Views folder. They should probably be at the same level as Views, not inside it.

Let me know whether this fixes it for you, and if so, mark the answer as correct. Thanks.

Newish developer scoping error question.
 
 
Q