Tuesday, January 12, 2016

Day 57

Data Persistence via PLists


So far, every app I've made so far does not have data persistence, meaning that when I close out of the app, everything is reset. The CodingDojo learning platform gives us a way to store data via Plists. This involves creating a database file that uses the plist as well as another file that contains a program to encode and decode data(because things stored in plists have to be in UTF-8 unicode). Honestly, I don't really like this method, it's very clunky with the encoding and decoding and I don't know what is actually in my database if I were to put in something wrong.

I also learned about table views, a very common aspect of a lot of iOS apps. Going back to protocols and delegates, when we use table views, we either let our controller be the UITableViewController or if you were using a view controller with a table in it, then use UITableView. This is required to let the controller recognize that there is a table but also a good (or bad) thing about writing in Xcode is that, every time you implement a UI class, it already is a protocol. Meaning that whatever code you put into that class, has to conform. A cool function is to alt-click anything in your code and there will be documentation on what is required for that particular class. For tableview, there must be a function that returns how many rows there are and another function of what is going to be displayed in each row cells.

No comments:

Post a Comment