Getting Started with AWS AppSync for iOS | raywenderlich.com

Learn how to consume GraphQL APIs in your SwiftUI iOS apps in a simple and type-safe way using AWS AppSync framework.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/16681770-getting-started-with-aws-appsync-for-ios

There is no schema.graphql that appears anywhere inside the source.

Hey @dpalme! schema.graphql is a file generated by the run script added in this step https://www.raywenderlich.com/16681770-getting-started-with-aws-appsync-for-ios#toc-anchor-010. After adding the Run Script and building the project you should see a folder called AmplifyConfig inside your RazeList project in Xcode. schema.graphql should be in there. If you’re not seeing it after following these steps please let me know and I can investigate further.

Hey! Thanks for the course, pretty nicely explained step by step!

Everything went great, build app succeeded, Ive choose the closest server to my location (EU-West-2). But the build up takes ages (1-2 minutes). Every time Xcode has to build like 800 tasks and that is even without adding content to it. I am on that step so far " Building the To Do List UI"

What am I doing wrong? Many thanks!

Hi again,
I believe I found what part really slows down the build up:


When you change push to true. That line also makes Auto-preview on SwiftUI not working, it pauses automatically right after resuming.
Many thanks for help

EDIT:
Apologise for so many messages. I have managed to build an app but Im getting that error:

Could not save item with error: DataStoreError: The operation couldn’t be completed. (SQLite.Result error 0.) Recovery suggestion: The operation couldn’t be completed. (SQLite.Result error 0.) Caused by: no such table: Todo (code: 1)

Not sure what could go wrong as I have literally copied and pasted your solution just to be sure that is going to work.
Also, It’s impossible to run your final version. Project builds, succeeds and nothing happen after that.

Also, Xcode finds around 60 issues (in AWSCore, AmplifyPlugins, SQLite, Starscream). Is that normal? Thanks

EDIT2:

I think it may be important to mention that I operate from MacBook Pro with the M1 chip.

SOLVED:

For anyone who may have difficulties:

Next, open amplifytools.xcconfig in the same directory. Change push and modelgen to true.

Build and run your project. When the build finishes, there will be a new directory in your Project navigator called AmplifyModels. Changing the line above in the configuration told Amplify to generate your model files for you from the GraphQL schema and update your configuration on AWS. Expand AmplifyModels and take a look around. You’ll see Todo.swift containing your model and some helper files.

After that step go to amplifytools.xcconfig and switch modelgen to false. Otherwise Project will generate another model that is default for AWS Amplify and delete the one that you just created.

Thanks!

You probably figured it out but the push deploys to aws which takes several minutes. ModelGen takes your schema.graphql which of course is written in GraphQL and uses it to create all of the models as structs which Swift knows how to consume.

Thank you for the tutorial.
I thing the script .sh is deprecated now.

I tried to follow the tutorial to make a RESTfull API but did not work. Did someone succeed in deploying Restfull API with DynamoDB with amplify and iOS?

Hi! Thank you very much for the tutorial.

I’m following the tutorial with XCode 12.5 and I’m getting the following error when building the project after adding the “${PODS_ROOT}/AmplifyTools/amplify-tools.sh” script:

error: Minimum version required of Amplify CLI is not installed.
Min required version: (4.22.0)
Found Version: (e[0m5.0.0e[0m)

install the latest version, please run the following command:
npm install -g @aws-amplify/cli@latest

I did the npm install but not same error after installing latest amplify version.

Could somebody help with that?

Thank you in advance!

Hello,
Thank you for this simple and good explanation.
I have an issue once I launch my swift app for the first time (after build), I can’t get data loaded correctly. I should wait until the status of Datastore is ready.
The problem here is that I don’t know how to do that and pause the app until the status is ready before calling Amplify.datastore.query. Can anybody help please.

Thank you in Advance