database development, so I wanted to bring this experience to this book. I have worked with many of the
popular database systems over the years, like Oracle, MSSQL, and DB2, not to mention oldies like Borland
Dbase4, Lotus Approach, Superbase95, and, of course, Lotus Domino. However, I am uniquely impressed with
SQLite. The versatility of this technology is incredible. You can take a SQLite database that was created on a
Did you know that SQLite was once the basis for the Web DB specification in an early version of W3C’s
HTML5 specification before being dropped from the final release candidate in 2010? The technology is in
widespread use across most computing platforms, including mobile and embedded systems. Apple uses SQLite
on both OSX and iOS for various applications. For data-driven iOS applications, SQLite is the logical choice.
There are other choices, like InterBase or BerkeleyDB, if you want to use a relational database, or you can go the
NoSQL route and choose Couchbase or Realm, among others. However, SQLite offers a solid footing and strong
industry support, which I find is essential if you are planning a production-grade data-driven iOS app.
With the introduction of Swift, Apple has provided millions of iOS developers with a modern, well-
designed programming language in tune with Python, Ruby, Scala, Groovy, and many others. The language
is fun to work with. It is also much less verbose than Objective-C, and I have had the opportunity to work on
an iOS project with this language and found Swift to be a great, lightweight language to work with.
Since the first edition of this book was completely written in Objective-C, with one chapter on a beta
version of Swift 1, I felt it was time to re-write the book using Swift 3 and iOS 10. I wanted to explore the
opportunity this new language offers to build data-driven apps using SQLite as a backend. I also wanted to
show you how easy it is to create bridges in Swift to interface with SQLite’s C API—or any C/C++ API, for that
matter—to harness many of the mature libraries that have been developed and have stood the test of time, as
well as new ones, through Swift.
In keeping with the original design of the first edition, Build iOS Database Apps using Swift and SQLite
walks you through the steps of creating a bridge, developing SQLite databases, and performing the standard
CRUD operations that characterize a database’s core functionality of storing and retrieving data. I also
wanted to explore extending SQLite with custom functions and attaching them using Swift, and to look at the
multi-database and backup APIs.
The code for the apps in the book was written in Swift 3. I hope you find the book useful and practical.