Photo by Evan Dennis on Unsplash

Optional is a fundamental type in Swift. While it’s almost everywhere, most developers don’t use it to the full extent or even use it in a wrong way. Optional binding opposes DRY principle and introduces unneeded conditionals.

In this multipart series we’ll discuss what Optional really is, how to use it correctly and apply some advanced stuff in order to create convenient functional eDSL for Optional computations.

Other important topics are dependency injection strategies in Swift, error handling, implicitly unwrapped Optionals and type casts. …

… almost :)

Swift brings lots of opportunities to iOS development. There are pretty useful functional hooks among them. Some people immediately associate functional programming with complex math and the M-word, but that’s not really the case. Functions are the real power in functional programming.

In this article we’ll see how to use some of them in order to make your daily Array routine comfortable, avoid code duplication and unnecessary typing just by using functions.

The problem

Reviewing a colleague of mine, we discussed the next function:

Simple computatios, right, but the flow is so nonlinear and nested. Is there a way to make…

Anatoly Tukhtarov

iOS Developer at Ciklum Digital

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