Tutorial

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

  • Install Node.js version 12.x or higher

  • Install Xcode version 11.4 or later

  • Install Amplify CLI version 4.22.0 or later by running:

    npm install -g @aws-amplify/cli

    npm install -g @aws-amplify/cli

    Note: Because we’re installing the Amplify CLI globally, you might need to run the command above with sudo depending on your system policies.

    curl -sL https://aws-amplify.github.io/amplify-cli/install | bash && $SHELL

    curl -sL https://aws-amplify.github.io/amplify-cli/install | bash && $SHELL

    curl -sL https://aws-amplify.github.io/amplify-cli/install-win -o install.cmd && install.cmd

    curl -sL https://aws-amplify.github.io/amplify-cli/install-win -o install.cmd && install.cmd

Set up your application

Create a new iOS application

  1. Open Xcode. From the menu bar, select “File -> New -> Project…”

  2. Select App, and then select the Next button.

  3. Fill in the following for your project:

    • Product Name: Todo
    • Interface: SwiftUI
    • Life Cycle: SwiftUI App (only relevant if Xcode 12 is being used)
    • Language: Swift
    • Select the Next button

  4. 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 for iOS 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 Todo project. For example, if you created your project in the folder ~/Developer, you can type the following:

    cd ~/Developer/Todo

    cd ~/Developer/Todo
  2. To create the Amplify app first you will need to use the amplify CLI you previously installed. Run the command:

    amplify init --quickstart --frontend ios

    amplify init --quickstart --frontend ios
  3. Switch back to Xcode. Select File > Swift Packages > Add Package Dependency.

    Add package dependency

  4. Enter the Amplify iOS GitHub repo URL (https://github.com/aws-amplify/amplify-ios) into the search bar and click Next.

    Search for repo

  5. You’ll see the Amplify iOS repository rules for which version of Amplify you want Swift Package Manager to install. Choose the first rule, Version, as it will use the latest compatible version of the dependency that can be detected from the main branch, then click Next.

    Dependency version options

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

    Select dependencies

You can always go back and modify which SPM packages are included in your project by opening the Swift Packages tab for your project (Project file > Project > Swift Packages)

You are ready to start building with Amplify! 🎉

Previous Page
previous

Prerequisites

next

Generate model files

Next Page
Discord Logo
Amplify open source, documentation and community are supported by Amazon Web Services © 2020, Amazon Web Services, Inc. and its affiliates. All rights reserved. View the site terms and privacy policy.
    Flutter and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.