Along my journey of writing code for iPhone and iPad apps, I’ve been contributing to a discussion board among a group of App designers. In the hope that this info helps others – here you go!
MANAGING DATA in your APP
(and links to videos with step-by-step instructions)
As you probably already know, in most any app you’re going to have to figure out how you want to manage your data. With a small amount of data, you can handle it straight in your code with an array or dictionary. Once you start managing a lot of information, you’re most likely going to want to branch out with other tools.
Options explored in this article:
- use a plist file
- use core data
- use sql database (create on your website and link to your app)
- and of course, you can also just use an array / dictionary in your code
Option 1. PLIST file (Property List file)
What is it? It’s a file in XML format. If you’ve ever seen html code, it looks very similar to this but instead of a <tag> it has a <key> and data such as <string> or <integer>. I’ll go more into this in a future blog post, but for now, here’s some videos to get you started:
Example One – PLIST
This is a very simple video (but no voice). They start with creating the file (like I explained above), and then adding data from there. They provide a link to download the source code.
<Update 5/2016 – This video has been removed from YouTube>
Example Two – PLIST
In this video, things are explained better and it has voice (how to access file, how to write and read data using code).
Note these are all in Objective-C. The actual plist file is the same in Objective-C or Swift once it’s created. I think manual creation outside of the app is easier in many ways if you already have your data. I’ll cover that in my next post.
Option 2. Core Data
First off , here’s some basic tutorials on using core data (you know – that little check box when you first create your project). Here’s two for you:
<UPDATE (5/2016) – This video has been removed from YouTube>
Note that this is an earlier version of Xcode, so some things have changed (push is now show, and I created a navigation bar on view controller first, then added segue).
Option 3. SQL Database
I like this guy. I’ve done a bunch of his Obj C Tutorials too…
This one includes setting up server / briefly watched but didn’t go through all of it but should help newbies
Here’s info for the website side of things (if you need a refresher) Includes PHP
And here’s another one if you’re using WordPress. I’ve never used GatorHost, I usually use GoDaddy but the cPanel stuff is all the same. This walks you through setting up the access and then creation. It has nothing to do with the app, but you have to do this first to get to the data!
I plan to do a more detailed post on this subject as well.
Option 4. Arrays and Dictionaries
Lastly, if you just want to use an array (or dictionary) to manage your data, there’s tons of great sample projects out there. When I was first learning apps I used this a lot.
This guy is pretty fast and goes through a lot – so I like that! He has a bunch of videos on YouTube. This should get you started…
Here’s another good one – starts with setting up table (adding table view to view controller,
using UITableViewDataSource instead of UITableViewController) and then walks how to add data in subsequent videos:
Here’s one using struct and array to pass data: