Swift (iOS/macOS) and Databases: A Practical Guide
Swift (iOS/macOS) and Databases: A Practical Guide
Summary:
The book "Swift (iOS/macOS) and Databases: A Practical Guide" is a comprehensive resource for developers who want to master working with data in the Apple ecosystem. The author, Alexey Smirnov, is an experienced iOS engineer with 10 years of experience, sharing proven approaches and real-world cases from commercial development.
The book covers all key data storage technologies available in Swift:
- Core Data – Apple's framework for object-relational mapping, working with NSManagedObject, migrations, iCloud synchronization
- SQLite – low-level work with relational databases via FMDB and GRDB
- Realm – a modern alternative to Core Data, reactive queries, encryption
- CloudKit – cloud storage with seamless integration into iCloud
- Firebase Firestore – a real-time NoSQL database for synchronization between devices
- UserDefaults and Keychain – lightweight ways to store settings and confidential data
Each chapter is built on the principle of "from theory to practice": first, the architectural features of the technology are analyzed, then step-by-step examples with ready-made code follow. The book covers real-world scenarios:
- Creating an offline notes application with synchronization via CloudKit
- Developing a product catalog with search using SQLite
- Building a chat with instant messages on Firebase
- Migrating from Core Data to Realm without data loss
- Query optimization and caching for high-load applications
Special attention is paid to performance, data security, and testing. You will learn how to avoid race conditions during multithreaded access, how to encrypt databases, and how to write unit tests for the persistence layer.
Who this book is for:
- Junior and Middle level iOS/macOS developers who want to deepen their knowledge of working with data
- Developers transitioning from other platforms (Android, Web) to Swift
- Students and beginner programmers learning Swift and wanting to create full-fledged applications
- Team Leads looking for best practices to choose the right database for a new project
After reading the book, you will be able to confidently select and integrate the appropriate database into any Swift project, understand the trade-offs between performance and functionality, and design a robust data storage architecture that will work on hundreds of thousands of devices.
The book is written in clear language, contains many diagrams and charts, and all the code is available for download in the repository. It is suitable both for self-study and for use as a reference guide.