← All topics/Data persistence

Data persistence interview questions

Scenario-style prompts with sample answer outlines. Focus is on how you would design and reason in real codebases.

  1. 01Choosing the right storage strategyYou're building a feature with structured data, user settings, and large media files. How do you decide what goes in Core Data/SwiftData vs files vs Keychain?
  2. 02Designing a scalable data modelYou're designing a local database for a feature with relationships (such as users, posts, and comments). How do you model it to balance performance, flexibility, and future changes?
  3. 03Handling migrations in productionYou need to evolve your data model after shipping. How do you handle migrations safely without data loss or breaking existing users?
  4. 04Offline support and syncingYour app needs to work offline and sync with a backend. How do you design your persistence layer to handle conflicts and ensure consistency?
  5. 05Performance with large datasetsYour database grows to thousands of records and performance degrades. How do you diagnose and optimize reads/writes?
  6. 06Normalized vs denormalizedIn simple terms, what does normalized mean for a database? What does denormalized mean? Give a couple of real-world examples.
  7. 07SwiftData, concurrency, and data racesHow do you avoid data races when reading and writing SwiftData from Swift concurrency (async/await, actors, background work)?