Logo dotSwift Register
Swift logo

Swift Training

Functional Core in a Shipping App


Teacher:

Content:

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.

Syllabus:

The actual contents may vary on the day of training but the likely topics are:

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

Student requirements:

It is assumed that you are an experienced programmer who has spent time with Swift. You will need a Mac running the latest version of Xcode.

A Menagerie of Monads


Teacher:

Content:

This one-day, fast-moving workshop will help you answer both “how do I use Monads” as well as “why and when do I use them.”


We’ll begin with the familiar Array and Optional examples for map and flatMap as a way to motivate the definitions of and differences between Functors and Monads.


We’ll then explore examples of monads such as the State monad, the logging monad, and futures to see why we need both map and flatMap.


We’ll end the day by looking at an important function that lives between map and flatMap: apply.


By the end of the day you should have a strong mental model of Monads, Applicatives, and Functors and see how you might use them in your shipping applications to simplify your code.

Syllabus:

The actual contents may vary on the day of training but the likely topics are:

A Menagerie of Monads Syllabus

  • Map in the standard library
  • FlatMap in the standard library
  • Pure and the connection between map and flatMap
  • Functors, Monads, and a brief look at Applicative Functors
  • The Result type - chaining steps together
  • The State monad - using a random number generator example
  • The Logging monad - generating a log as we go

Student requirements:

This course assumes you are an experienced programmer who is confident with Swift. You will need a Mac running the latest version of Xcode.