/persistence-demo-ios

💾 Offline app demo

Primary LanguageSwift

Persistence Demo

Demo project made with https://jsonplaceholder.typicode.com API.

Project setup

Dependencies in this project are provided via Cocoapods. Please install all dependecies with pod install.

  • macOS 10.10+
  • Xcode 10.0+
  • CocoaPods 1.6.0+

Technical decisions

Overview

The application is based on MVVM (model–view–viewmodel) pattern. ViewModels are structuting relationships between model and user input or controllers life cycles as pipeline of transformations. Respositories are implemetned for each resource with need to be stored in persistance layer. DataSources (both local/remote) also are implemented per resource. Connectors are used for handling navigaiton between view controllers; it also allows to decouple them. Connectors have the reference to dependecy container in order to allow them resoloving objects from it.

Application architecture diagram.

Database

For persistance Core Data with base setup - two contexts connected to same persistent store. Private context is used for importing data from a web service. Main context is used for UI related work.

Core Data setup.

Tools & Libraries

  • Sourcery for code generation, used via protocols AutoEquatable, AutoMockable.The configuration is available in .sourcery.yml.
  • Swiftlint - for enforcing code style and producing warning or errors if they are not followed, there is an additional step in the build process for running The configuration is available in .swiftlint.yml.
  • RxSwift - for reactive programing.
  • Dip - for depndecy injection.
  • RxTest - for testing rx code.
  • SwiftGen - for generating type-safe resources, there is an additional step in the build process for running The configuration is available in swiftgen.yml.

Materials