Functional Core in a Shipping App (Intermediate) [Part one]
In this workshop, we’ll look at how to build a functional, testable core and how to use it with different iOS app architectures.
In Swift we emphasize immutability, value types, and the use of generics, higher-order functions, and closures. We may be writing Swift apps, but the frameworks our iOS and Mac apps are built on are still written in Objective-C. Foundation, UIKit, AppKit, and other frameworks are based around reference types and the familiar design patterns we’ve used for years with these frameworks.
Our goal is to explore strategies to successfully blend these two worlds.
We’ll begin the workshop by test-driving an immutable model. We’ll then use this model in a basic table based app. We’ll then experiment with different architectures to emphasize how we can isolate and take advantage of the best of Swift in a robust and flexible iOS app.
Functional Core in a Shipping App
* We begin by test-driving a simple model
* We adjust to make the model instance immutable
* We specialize the model to take advantage of recent additions in generics
* We build out a use of the model that illustrates MVC
* We introduce a view model
* We rearchitect using MVVM
* We evolve to a reactive like architecture