As before with the settings, creating data online requires creating an input object instance. That's then used to create a mutation which is then passed into the performed call on the AppSync client. The last parameter of the call takes a closure which receives the result or error. These can be checked for success.
- [Instructor] So now we have all…the support code that we need…to create posts online,…retrieve them, everything.…Let's work on storing them on the server.…So, the first thing we need to do…is open up our ThoughtsTVC.swift file…and we need to add a couple of items…to our TPost class that we added to the schema.…So, on line 14, we're going to add a new line…and type var id equal empty string literal…and, on line 16, var userId equal empty string literal.…So, now we have all the pieces that we're storing online.…
Next, we're going to search for postThought.…This is where we store the posts currently.…On line 93, we have the postThought function…that takes the post.…We just add it to the array and reload the table.…We're going to delete both those lines 94 and 95…and now we're going to store it on the server.…So, the first thing we're going to do…is we're going to take the post that's passed in…and type post.id equal UUID open close…paren uuidString.…So, we're going to set the id of the post.…Then, we got to create an input just like we did…
- Preparing to use AppSync in code
- Updating settings and the schema
- Adding a second data source
- Storing posts online
- Updating subscriptions in schema
- Testing live updates
- Handling updated posts
- Offline capabilities
Skill Level Intermediate
1. AWS User Authentication
2. AppSync Setup
Amplify codegen3m 42s
3. App Code and Configuration
4. Adding a Second Datasource
5. Real-Time Updates
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.