Why do I keep getting "Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value" ?! Isn't Swift supposed to be easy?
What does nil mean? Why finding nil causes the program to crash?
You asked online and some people suggested using if let and guard let to prevent the crash, but what
doesthese mean?! Some suggested to never use the "!" symbol in codebut Xcode complains when you don't do so.
You Googled online, found some articles which provide fixes, but you still don't understand why those fixes
work ,and you're back to square one the next time you are greeted with the same "Fatal error: Unexpectedly found nil" error again.
Wouldn't it be good if those funky symbols ("?", "!") doesn't exist? Instead of spending hours fighting with errors, you could focus on the fun part - building features for your app!
optionalsare there in Swift, and with good reason, there's no way to avoid it, but we can understand it, be friendwith it and use it to our advantage when building features!
What if you could focus on the fun part - building
What if you are able to navigate through the symbols (
? , as! ) easily? You could save hours trying to wrap your head around the errors and focus on your code. Imagine being able to indulge in building features you like and see the result appear in your phone, wouldn't that be great? ! ,
You could finish the app idea that you have been wanting to work on, submit it to the App Store, and have a better resume for
applyingiOS developer positions.
Understand how and why Optionals works and use it to your advantage
Optionalsare there for a reason, it's to help your code to deal with absenceof values (nil / null values). eg: What should your code do if the expected data doesn’t appear?
When we don't understand how something works, we tend to get intimidated by it (eg: High school maths, how
computerworks, etc). But once we understand them, it will be easy to navigate around them and use it to help with our daily lives!
Learn the purpose of
Optionals, and how to use them to aide your app development process with the book 'Understanding Optionals'
This book will cover :
- How does
- Unwrapping Optionals forcefully
- How to handle
optionalssafely, using if let and chaining
- Providing default values when the expected values aren't there
- Explaining various jargons (eg: optional binding, implicitly unwrapped
- Solving 'Unexpectedly found nil' error which relates to Storyboard UI (eg:
nameLabel :UILabel! )
- Treating an object as another type safely
This bundle pack also includes two extra booklet which explains :
- How to use 'guard' statement to simplify optional handling
- How delegate works (+ 2 Xcode playground file to demonstrate how it works)
+ 1 Optional Cheatsheet that you can quickly refer to when you are not sure what the jargons (optional binding, implicitly unwrapped optional etc) means.
1 PDF / ePub of Understanding
1 PDF / ePub of Simplify Optional Handling using Guard book
1 PDF / ePub of Explaining Delegate book
2 Xcode Playground file to help demonstrate the delegate concept
1 PDF Cheatsheet of Optionals
Each book is concise and tightly focused on getting you to understand the concept of
optionalsand delegate, instead of watching a full iOS development video course and finding answeron the #11 video, you can finish read the book in 2 hours and continue on with your app projects!
You can get two sample chapters of this book here.
If using this book does not help you learn and understand
optionalsor delegate, let me know, within 30 Days of the date of your purchase, and I'll give you a complete refund. No argument. No risk. 100% guaranteed. You can contact me at email@example.com