In order to create a package, you will use the swift package command.
Running the command without any argument will print in the terminal the different options and subcommands you can run. As we are getting started, here are the most important ones:
- swift package init: Initializes a new package.
- swift package update: Updates package dependencies.
- swift package generate-xcodeproj: Generates an Xcode project.
- swift package describe: Describes the current package.
As we are getting started with SPM, the command we are the most interested in is swift package init.
Swift Package Manager is designed to build command-line tools and libraries for Linux and macOS targets. You will not be able to depend on Apple's proprietary frameworks, such as UIKit. Note that swift web apps (Kitura- or Vapor-based) are a perfect scenario to use SPM.
For the example,...