I can't find *.swift file in my project's directory

Hi, everyone. I am trying to print out “Hello, world” by creating a Command Line tool project. I try to type “swiftc Hello.swift” to compile it in the terminal but instead of having a file named Hello.swift, I have a file named by default Hello.xcodeprojec. How I can solve this issue?

Answered by darkpaw in 796467022

Hello.xcodeproject is your Xcode project file. Among lots of other things, it keeps track of where the files are for this project.

You need to create a Hello.swift file in your Xcode project.

Load the Hello.xcodeproject file, and see if there's aHello.swift file in the project view on the left.

If not, then you have to create one, and write your code in there.

If there is - and it's red - it means the file has been moved and Xcode doesn't know about it. If you can locate it (use Spotlight) you can put it back in the same folder as the Hello.xcodeproject file.

How about launching the project file and taking a screenshot to show us what's in the left side project view?

Hello.xcodeproject is your Xcode project file. Among lots of other things, it keeps track of where the files are for this project.

You need to create a Hello.swift file in your Xcode project.

Load the Hello.xcodeproject file, and see if there's aHello.swift file in the project view on the left.

If not, then you have to create one, and write your code in there.

If there is - and it's red - it means the file has been moved and Xcode doesn't know about it. If you can locate it (use Spotlight) you can put it back in the same folder as the Hello.xcodeproject file.

How about launching the project file and taking a screenshot to show us what's in the left side project view?

I simply exported the project in *.swift extension in the same directory and then I used the terminal to enter the file directory and then with the command swiftc to compile it after which I ran it with ./file name and it worked out.

I can't find *.swift file in my project's directory
 
 
Q