Fetching data is a little bit different than creating data online. A query instance is created and any parameters for filtering the fetched data is set. The AppSync client has a fetch function that takes the query and a cache policy to enforce. It also takes a completion handler closure to receive the data or error.
- So now we're ready to use the API.swift classes…that were generated for us to download the settings…from the server.…So, in the load settings function,…I want to delete the first few lines…where we're loading it from the user default.…So I'll delete lines 162, 163, and 164.…And the first thing I want to do is…I want to get the userID.…And I'll do that in a guard statement.…So, I'll say guard let user ID equal aws,…mobileClient.sharedInstance.identityID, else, return.…Next, I'm going to create a query.…
On line 163, I'll type let q equal ListSettingssQuery.…And notice that I named my object Settings,…and so the plural was made Settingss.…Since we want a filter on the userId,…I want to create a model string filter input…that equals the userID.…So on line 164, I'll type let userIDFilterInput…equal ModelStringFilterInput.…And I want to specify that it equals userID.…
For the model string filter input,…you can specify if something is not equal to,…less than, contains, betweens, and so on.…We want it to equal the userID.…
- 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.