Page updated Apr 3, 2024

Set up fullstack project

👋 Welcome! In this tutorial, you will:

  • Set up an iOS application configured with Amplify
  • Create a data model and persist data to Amplify DataStore
  • Connect your local data to synchronize to a cloud backend

Prerequisites

  • Xcode version 14.1 or later
1npm install -g @aws-amplify/cli
1curl -sL https://aws-amplify.github.io/amplify-cli/install | bash && $SHELL
1curl -sL https://aws-amplify.github.io/amplify-cli/install-win -o install.cmd && install.cmd

Create a new iOS application

  1. Open Xcode. From the menu bar, select "File -> New -> Project..."

  2. Select iOS tab, choose Application type as App, and then click on Next.

  3. Fill in the following for your project:

  • Product Name: Todo
  • Interface: SwiftUI
  • Language: Swift
  • Select the Next button

After selecting Next, select where you would like to save your project, and then select Create. You should now have an empty iOS project without Amplify.

Add Amplify to your application

Amplify Library for Swift is distributed through Swift Package Manager, which is integrated into Xcode. In this section, you'll add the required Amplify packages.

  1. Open a terminal window and change to the directory for your application project. For example, if you created the previous Todo project in the folder ~/Developer, you can type the following:
1cd ~/Developer/Todo
  1. To create the Amplify project first you will need to use the amplify CLI you previously installed. Run the command:
1amplify init --quickstart --frontend ios
  1. Switch back to Xcode. Select File > Add Packages...

    Add package dependency

  2. Enter the Amplify Library for Swift GitHub repo URL (https://github.com/aws-amplify/amplify-swift) into the search bar and hit Enter.

    Once the result is loaded, choose Up to Next Major Version as the Dependency Rule, then click Add Package.

    Add the Amplify package

  3. Lastly, choose which of the libraries you want added to your project. For this tutorial, select AWSAPIPlugin, AWSDataStorePlugin, and Amplify, then click Add Package.

    Select dependencies

You are now ready to start building with Amplify! 🎉

You can always modify which packages are included in your project by opening the Package Dependencies tab under the project settings.

Click the Todo project in the Project Navigator to open the Project Editor, select Todo under Project and then click on the Package Dependencies tab.

Edit dependencies