Project setup

Quickly setup the Xcode project and run the app


Setting up the project and running the app is very simple. The project uses Swift Package Manager to manage all dependencies so everything will be automatically downloaded as soon as you open the project in Xcode.

Clone the repostory

The first thing you have to do is to clone the GitHub repository so you can work on that locally. To clone the repository you can run this command:

  • For SSH: git clone git@github.com:Swift-Sail/swift-sail.git
  • For HTTPS: git clone https://github.com/Swift-Sail/swift-sail.git

In order to use SSH method you first have to add your SSH public key into GitHub. Follow this guide to add your SSH key

Install required dependencies

SwiftSail uses SwiftGen for resources generation. Make sure to install it like this:

Install SwiftGen
# Install HomeBrew is you do not have it already
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
 
# Install SwiftGen
$ brew update
$ brew install swiftgen

Renaming the project

Next, you can open the project in Xcode and rename it so it matches the name of your product you will be building:

A. Use rename script

In the SwiftSail project, there's a file called rename.swift in the scripts folder provided by Tadija. You can use this script to rename your project quickly.

Run this command:

./scripts/rename.swift SwiftSail your-project-name

This script will rename everything that needs to be renamed and no further action is required from your side.

B. Rename manually

  1. Open the Xcode project
  2. In the Project Navigator on the left side of Xcode, click on the name of the project and press Enter. The name becomes editable and after you type in the name of your product, press Enter again.
  3. You also have to rename the scheme:
    1. Navigate to the top-left corner of the Xcode window and locate the scheme dropdown menu. It's usually located next to the play/stop buttons.
    2. Click on the scheme dropdown menu to reveal a list of available schemes for your project.
    3. From the context menu, select Manage Schemes.... This will open a new window with a list of all the schemes in your project.
    4. In the Manage Schemes window, locate the scheme you want to rename. Click once on the scheme name to select it, then click again (slowly) on the name to enter edit mode. Type the new name for the scheme and press the Enter key on your keyboard to confirm the new name.

Bundle ID

After you renamed your project, make sure to navigate to Xcode -> Click on your project in the Project Navigator -> On the top of the screen click on Signing & Capabilities -> change the Bundle Identifier to your own.

In general, it should looks something like com.marospetrus.swiftsail. Replace marospetrus with your name and SwiftSail with your app name.

Run the app

Now you should be ready to run the app. In order to test In-App Purchases, don't change the RevenueCat API key which is provided by me for my demo account.