Join Bill Weinman for an in-depth discussion in this video Choosing SQLite, part of iOS App Development: Building Data-Driven Apps with SQLite.
- When considering how to store persistent data on an iOS device, there are several choices available. The major choices include PLIST files, SQLite3, and Core Data. Each of these choices have their strengths and weaknesses. PLIST files are the simplest form of data storage on iOS. A PLIST is a Property List file. It's a structured XML text file. Its major advantage is that it's easy to create and manage. It's great for small sets of data like a configuration file.
But it doesn't scale well for larger sets of data. Core Data is a very powerful framework for storing iOS objects. It's tightly integrated into iOS, provides a full set of options for managing many aspects and properties of your data. It scales well and provides access about Cloud and on device storage. Core Data is designed to make the programmers job easier at the expensive performance and complexity. In many applications, this is a good trade off.
Core Data is tightly integrated into iOS. SQLite is a fully functional relational database engine that comes built-in with iOS. In fact, Core Data uses SQLite for some of its storage. SQLite is small, fast and extremely efficient because its architecture lends itself well to mobile applications. Because it's free and open source. SQLite is built-in with most mobile operating system including iOS and Android.
It's also available for Windows phone. For this RSS application, we need to store RSS feeds, items and related data. We need to be able to add and delete feeds and items and we need to be able to access that information based on a few different keys. So how do we decide which storage method to use for this application? A PLIST file is not scalable for the amount and type of data we want to store. Core Data would work fine and I would definitely choose it if there weren't a better option.
SQLite is actually kind of perfect. It's not as powerful as Core Data but it has everything we need and it's smaller and faster. It's also very portable. It'll make it easy to port this application to other platforms and even to share data with other applications on the same device. Other people may choose Core Data for this application and they wouldn't be wrong, for my purposes, and this may be somewhat do my familiarity with SQLite, I like it a lot for this purpose. I tend to favor smaller and more efficient solutions and SQLite often fulfills that criterion for me.
- Building a testbed
- Creating an Objective-C interface for SQLite
- Creating a CRUD interface
- Designing the database schema
- Creating the main table view
- Creating the items table view
- Adding new feeds
- Parsing feeds with NSXML Parser
- Viewing webpages
- Preparing icons and toolbar images
- Adding a preferences pane
- Including pull-to-refresh and other features