To round out the CRUD functionality you need to add the ability to delete rows on the server. It follows the same pattern as create and update. You need to create an input and a mutation. Then, the app sync client is used to perform the mutation. Locally, you can update the model and the UI in the table view.
- So now that we can add posts and fetch posts…from the server,…we want to look at deleting posts.…So currently in our app,…we have some functionality to delete.…On line 168 we have the…commit editing style function,…and it just removes the row.…Well we're going to remove that call…and add a new function called…delete post,…and it takes the parameter at,…and we're going to pass in the row to delete.…So we need to write that new function,…so underneath this function on line 177,…I'm going to add a new function, delete post,…with their argument label at,…and a parameter name index of type Int.…
So this is going to delete the post from the server.…So the first thing we're going to do on line 178…is get the post we're trying to delete.…So I'll type let post equal posts…and pass in as the sub-script index.…Then, I'm going to guard to make sure that…the user I.D. setting in this post…matches who I am.…I don't want to be able to delete other people's posts.…So I'll say, guard post dot user I.D. equal equal…AWS mobile client shared instance identity I.D.…
- 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
AWS Security Best Practices for Developerswith Carlos Rivas46m 31s 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.