Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 1.95 KB

app-local-settings.md

File metadata and controls

29 lines (20 loc) · 1.95 KB

App Local Settings

A small amount of data is currently stored in plist files. Initial goals were:

  • prevent complexity overhead of Core Data
  • prevent data loss when we auto-create the database (if a migration fails)
  • make data typed
  • inject storage layer as dependency.

Retrieving and storing the data is done via AppSettingsAction and most of the logic happens in AppSettingsStore. There are a few data models + plist files separated for specific features and use cases.

General use cases

How to add new property

Example for store settings use case:

  1. Add property to data model (GeneralStoreSettings.swift).
  2. Run rake generate to update Copiable implementation.
  3. Add get and set actions in AppSettingsAction.swift.
  4. Implement new actions in AppSettingsStore.swift. Use existing getStoreSettings(for:) and setStoreSettings(settings:, for:) helpers + storeSettings.copy(...) to update non-mutable settings struct.