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:

The book «Swift (iOS/macOS) and Databases: A Practical Guide» is a comprehensive resource for developers looking to master working with databases in the Apple ecosystem. Unlike many superficial tutorials, this edition offers a deep dive into data storage technologies, ranging from built-in solutions (Core Data, SQLite) to cloud services (CloudKit) and third-party frameworks (Realm).



The book is structured on the principle of «from simple to complex»: you will start by setting up local storage for a simple application, and then move on to designing multi-user systems with data synchronization. Each chapter contains ready-to-use code examples in Swift that can be adapted for your own tasks.



What you will learn from the book:

  • Core Data basics: creating a data model, NSManagedObject, NSFetchedResultsController, working with Core Data contexts and stacks.
  • SQLite and Swift: direct interaction with the database via the SQLite.swift library, writing queries, performance optimization.
  • Realm for iOS/macOS: quick setup, Realm objects, migrations, data linking, and working with threads.
  • CloudKit: integration with iCloud, designing public and private databases, synchronization between user devices.
  • Data schema design: normalization, indexes, relationships (one-to-one, one-to-many, many-to-many).
  • Migrations and versioning: how to safely update the database structure without losing user data.
  • Advanced techniques: data encryption, working with large volumes (pagination, lazy loading), storage testing.


Who this book is for:

  • iOS/macOS developers who want to systematize their knowledge of databases.
  • Beginner Swift programmers who have already mastered the basics of the language and want to create applications with persistent data storage.
  • Students and teachers of mobile development courses.
  • Developers transitioning from other platforms (Android, Web) and learning the Apple ecosystem.


All examples in the book were tested on Xcode 15+ and Swift 5.9+, but the core principles apply to older versions. The code is accompanied by detailed comments and explanations of architectural decisions.



After reading, you will be able to confidently choose the appropriate data storage technology for any project — from a simple notes app to a corporate application with cloud synchronization. The book will become a desktop reference that you will return to when designing new features.

Recommendations