The Complete Guide to Understanding Swift Optionals

Understand Swift optionals in less than an hour and silence those annoying compiler errors

The Complete Guide to Understanding Swift Optionals - Cover

Does the following feel familiar to you?

You are trying to write some code for your great app but the compiler keeps stopping you. You have no idea what the problem is and the obscure messages on the screen are not helpful either. They just make you want to give up coding and go do something else.

Swift optionals seem to make no sense at all. What problem are they supposed to solve, anyway? They just seem to create more.  You just can’t make sense of them and feel like you want to throw your computer out of the window. The syntax looks stupid and they make all methods very unintuitive to use.

It is also hard to know when to use a ! or a ?, since they seem to mean many different things. Even when you manage to silence the compiler, you are not sure you did it in the correct way. Get it wrong and a single nil value can sink your ship: your app crashes and your users get angry at you. In the end you just get scared of optionals and try to avoid them as much as possible. But you can’t: they are everywhere in Swift and they are not going away.

If this is what you feel about optionals, I have good news for you: it does not have to be this way. You can actually figure them out and understand why they exist and how to use them. And you can do it in just half an hour, if you are reading the right material. Put in a bit more time and you will be using optionals easily. When you will know what optionals mean, you will be able to confidently decide when to use ! or ?. And when the compiler stops you, you will easily spot the mistake, fix it in a second and go back to do what matters the most to you: write new features to improve your app.

This is why I put together a massive 40-page free guide about Swift optionals. It answers all your questions about them and also contains some more advanced techniques. This will make you write code without worrying about optionals ever again. You will even make them help you instead of fighting against you. How great is that?

In this free guide you will learn:

  • What problems optionals solve and why exactly you need them in the first place. You can start using them immediately in your code, even if they seem to make no sense to you right now. You will finally understand where ! and ? go, what they mean in each context and use them confidently without having the compiler bothering you all the time
  • When it’s not dangerous and actually needed to use implicit unwrapping, even if it has caused many crashes in your app until now
  • Some of the advanced optional techniques that the pros use to simplify their code, even if you don’t know anything about functional programming, monads and functors.
  • A detailed explanation of all those obscure terms you keep reading on the web, like unwrapping, optional binding, nil coalescing and guard statements. Never find yourself again not understanding the articles you read online because these terms have no meaning for you

What readers say:

“Apple should consider asking your permission to add your guide in their official documentations. It’s really one of the most interesting reading I had these last months.” – Yannick C.

Yes! I want the Complete Guide to
Understanding Swift Optionals

100% privacy. No games, no spam. Unsubscribe at any time.

Featuring