For the life of me I cannot find the solution anywhere, so it seems to me it is a Xcode playground bug.
Within the Sources folder, despite me declaring a class as public, when I try to access the class from a separate file (within the Sources folder), compiler will give me an error message that says it cannot find the class in scope.
However, when I run the playground and ignore the message, the program will build and run successfully, and the error message will disappear until I start to modify the code.
Strangely enough, it doesn't happen at in an App project; it only happens in playground.
I've made a simple demonstration using a playground file called "test" and screenshoted what has happened, which you can see in the attached photo below, please advise! Thanks a lot!
Tried solutions include:
- restart Xcode
- restart Mac
- delete Xcode and reinstall Xcode
Cannot find Person class in scope despite it being marked public
But the Person class is marked as public
Code compiles successfully regardless
Error disappear after running the playground, but comes right back as soon as I modify it