Load data from AWS DynamoDB table to a UITableView on iOS
One of the screens in my iOS app which is written in Swift is a UITableView.
Into this UITableView, I want to load data from AWS DynamoDB table named Books
.
Currently, this is the prototype cell I have on my storyboard:
In the table I have 3 attributes: "Name", "Price" and "ISBN".
What I want is to scan the "Books" table, and filter the results, so the "ISBN" attribute of the results will contain the digit "9".
After I have filtered results, I want to apply them to the UITableView, so the "Name" value will go the the label with the text "Name", and the "Price" value will go to the label with the text "Price". I want the "ISBN" value to go to some array so I will be able to recognize the "ISBN" of this book, according to its row index on the UITableView. For now ignore the picture, I already know what to do with it.
I did the same thing on Android too, using Java, by creating a data class (with get
and set
methods), scanning the table on the activity code, and then apply the data to the TextViews using an adapter class.
I'm new to iOS and Swift development, and I don't know really how can I do it, so I would be very happy if you would explain it to me step-by-step.
Could you please help me figure it out?
I cannot give you the exact answer you want but I'll point you to a very good example I saw on internet. Checkout DynamoDB iOS SDK sample app from AWS.
All you need is a object mapper and which will map the downloaded data from DynamoDB to your in-app Model class. Checkout function called refreshList() in DDBMainTableViewController.swift which downloads data and maps it into needed model.
Note: Do not forget to follow the setup steps on AWS page. Your app would only execute after you've followed the setup steps suggested on GitHub.
链接地址: http://www.djcxy.com/p/39404.html