Let's create our first program on Linux using Swift. Our first project will be a package. Create a directory named guesswho
and then enter the directory:
$ mkdir guesswho
$ cd guess who
Next we need to initialize a new package with the type being an executable:
$ swift package init --type executable
Creating executable package: guesswho
Creating Package.swift
Creating .gitignore
Creating Sources/
Creating Sources/main.swift
Creating Tests/
I want to point out a couple of things about the output of swift package init. First, using the swift package init command is optional and meant only to be a utility mechanism for generating files and directories you may need. Second, the package manager expects you to put your sources files within the Sources directory. You can further nest additional directories under the Sources
directory and the package manager will treat those directories as modules. Finally, when you want to create...