Swift (iOS/macOS) and Databases: A Practical Guide
300 pages
English
PDF
4.5

Swift (iOS/macOS) and Databases: A Practical Guide

Swift (iOS/macOS) and Databases: A Practical Guide

Author:

Year:

Summary:

This book is a practical guide for iOS and macOS developers who want to master all aspects of working with databases in the Apple ecosystem. Unlike abstract textbooks, the material is built on real projects: from a simple to-do list to a multi-user application with CloudKit synchronization.



What you will learn:

  • Core Data — creating a data model, NSManagedObject, fetch requests, working with contexts, and schema migration.
  • Realm — an object-oriented alternative to Core Data: fast writes, reactive UI updates, working with multithreading.
  • SQLite — direct interaction via GRDB and FMDB: writing complex SQL queries, indexes, transactions.
  • CloudKit — synchronizing data between user devices, working with public and private databases, conflict handling.
  • Firebase Firestore — integrating a NoSQL database into SwiftUI, subscriptions to changes, security via Rules.
  • Architecture — MVVM + Repository Pattern, database testing, performance optimization (batch updates, lazy loading).


Who this book is for:

  • iOS/macOS developers with a basic knowledge of Swift and SwiftUI/UIKit.
  • Specialists transitioning from other platforms (Android, Web) to the Apple ecosystem.
  • Students and junior developers looking to delve into the backend part of mobile applications.


Edition features:

  • All code examples are available on GitHub and tested under Xcode 15+ and iOS 17/macOS 14.
  • Step-by-step instructions: from project setup to deployment on the App Store.
  • A chapter on refactoring and testing: how not to lose data when updating an application.
  • Performance comparison: when to choose Core Data, and when to choose Realm or SQLite.


The book is written in a lively style, with an emphasis on practice. You won't just read theory — you will create several working applications that can be immediately used in your portfolio. Suitable for self-study and as a reference for daily work.



After reading, you will be able to confidently design databases for any Apple applications, avoid common beginner mistakes (memory leaks, UI blocking, data loss during migration) and choose the optimal storage for a specific task.

Recommendations