Hands-On Server-Side Web Development with Swift
上QQ阅读APP看书,第一时间看更新

Converting to the Xcode project on a Mac

As explained before, you can optionally take advantage of the powerful editing and debugging features of Xcode if you use macOS. The Vapor Toolbox CLI provides a convenient way for you to generate an Xcode project file from a generic Vapor project.

  1. In the current directory of your Vapor project, run the following Vapor Toolbox CLI command:
# Step 4: Generate Xcode project files
vapor xcode
  1. After a few minutes, Xcode project files will be generated. When you are prompted with the question Open Xcode project?, Press Y to open your project in Xcode:

  1. From the toolbar at the top left corner of Xcode, select the Run scheme and My Mac device. Then, click on the Play button (command + R) at the top left of Xcode to build and run your Xcode project. You should see the message Running Run : Run at the top.

Open the URL http://localhost:8080/hello again in your web browser; you should see the Hello, world! message. It confirms that Xcode is running your helloWorld Vapor app.