![]() Replace the contents of the Podfile with this: platform :ios, '14.0' Now we need to add the Amplify Libraries to our project by installing them with CocoaPods.Īt the root of your Xcode project, run the following: pod init & open Podfile The navigation pane will now look like this:Īll our files are ready and in place. In the navigation pane of Xcode, right click the source code folder and select “Add files to project”.Īdd both configuration files and the generated models folder at path/to/project/amplify/generated/models. We will need to add the configuration files and the generated models inside the amplify folder to our Xcode project. If you run $ ls at the root of your Xcode project, you should now see an amplify folder as well as two configuration files: awsconfiguration.json and amplifyconfiguration.json. It should look something like this: amplify pull -appId xxxxxxxxxxxxxx -envName staging Once the Xcode project is created, open the terminal, navigate to the root of the Xcode project and run the command provided in the “Local setup instructions” of the Admin UI. Now it’s time to open up Xcode and create a new project for our app. ![]() You will be presented with a popup containing the terminal command to pull down your Amplify project, as well as code snippets on how to initialize our model object in Swift code. Navigate to the “Data” section, and you will see that our model schemas have been added to this Amplify app.Īt this point, I’d recommend that you review the schemas for typos, correct property type, and/or properties being marked as “Is required”. Open the Admin UI to see an overview of the staging environment created for us. Amplify will begin creating our backend environment and prep all the resources to start using our models.Īfter a few minutes, you will see that the Amplify app has been created. Once you’re signed in, you will be prompted to create your app’s backend.Įnter an app name, select an AWS region, and click deploy. Now that the data schema of our app is complete, navigate to the “Deploy” tab and log in to or sign up for an AWS Account. To keep each Booking up to date with the associated Room, we will establish a one-to-one relationship in our schema.Įach of the properties on the Booking object will be required, including the relationship to the Room. Our app will show the user a list of their Booking‘s which will include the data of the Room itself. ![]() Lastly, we need to create an object that represents the booking of a room by the user. We also get to see that these schemas can support a lot of different types when we switch the type of price to Int.Įach of these properties will be represented by either a native Swift type or a type provided by the Amplify libraries, making our feature implementation feel native to the codebase. ![]() Add a Room model.Įach of the properties for our Room object will be required, so you will need to select the checkbox for each of the fields. Once the user is “signed in”, the first screen they will see is a list of rooms that are available to be booked. With the username field selected, select the “Is required” box on the right side of the screen. Let’s add a User model that will simply have an id and username. The prototype will allow different users to “sign in” by providing a username. Now that we have a blank data modeling canvas, we can start adding our models. Start off by heading over to and clicking the “Get started” button under “Create an app backend”.Ĭhoose “Data” as the feature to setup, select “Blank schema”, and click “Create new schema”. Implement prototype functionality with the generated models.Configuring Amplify in a native iOS app.This tutorial will show you how to configure the models required for the prototype and start using them in a native iOS app built in SwiftUI. Since this is a prototype, we will be focusing on building the concept of the app and feign other features like authenticating the user and storing photos. In this post, you will be using the Admin UI to prototype a room booking app that allows a user to sign in, view seeded available rooms, book one of those rooms, and see the bookings associated with that user. The new Admin UI feature provides an easy-to-use interface where you can layout the models of your app, create relationships between them, and pull the Swift representation of those models into your codebase. AWS Amplify now offers a new way to model your app’s data schemas that is easier than ever.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |