Book Review: App Architecture : iOS Application Patterns in Swift

Apple cemented MVC into the heart of iOS and UIKit. MVC isn’t the only way to write iOS applications. App Architecture compares MVC to a handful of other architectures for building iOS software.

About Architecture

Architecture — A loaded term

Focus on the concepts

Architecture is important. Design before code!

State of iOS App Architecture

  • View : UIView, et al.
  • Controller : UIViewController and derivatives.
  • Model : Core Data, PONSO (Plain Old NSObject)
  • Communication : Delegation, NSNotification, KVO.

The Big C

  • State becomes extremely hard to reason about.
  • Unit tests are equally massive, requiring a ton of boilerplate and infrastructure to setup.
  • More difficult to refactor.

Open Source to the rescue

  • Web — Elm, React, Flux
  • iOS — Viper
  • Functional / Rx
  • MVP, MVVM

Architecture Characteristics

  • Separation of Concerns
  • Unidirectional data flow (communication between layers)
  • Immutability

Separation of Concerns

Unidirectional Data Flow (UDF)

Immutability

Example Code

  • What layers of my application should I create? (Separation of concerns)
  • How are the layers going to communicate? Rx? Delegates? (Unidirectional data flow)
  • Who is responsible for changing a model’s state? (Immutability)

Final Thoughts

Final, Final Thoughts

Bibliography

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store