I'm writing a swift terminal program (let's say it's called "myProject") that requires me to save some files. I would like the files to be saved within the project folder programmatically.
I've seen in this post there are some environment variables like $(PROJECT_DIR) that give the path to the project folder. I've already checked that XCode does have the $(PROJECT_DIR) variable using:
$ xcodebuild -project myProject.xcodeproj -target "myProject" -showBuildSettings
But I'm not exactly sure how I can use this variable in my actual code. Like if I tried
print($(PROJECT_DIR))
I would just get the errors:
use of unresolved identifier '$'
use of unresolved identifier 'PROJECT_DIR'
How do I get the path to my project folder programmatically?