What is “Fatal error: Unexpectedly found nil while unwrapping an Optional value”?

var anVar: Int = 10
var anOptionalVar: Int? = 42
var anNonOptionVar: Int! //Have no valid value, this value is implicitly unwrapped, usually used in dependecy injection
var anUninitializedOptionalVar: Int? // `nil` is the default

--

--

--

iOS Developer | Swift | Flutter

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

A Guide to Surviving Your First (Or Hundredth) Retro

Gateways to the Web

Why I Chose Software Development

HBase Concepts & Best Practices

The AWS Well Architected Framework in a Nutshell

THE UNNATURAL “NATURE OF THE INDUSTRY”, PART 3

Empty Cart Button for WooCommerce

Chapter 18 | Boolean in Dart

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
Prafulla Singh

Prafulla Singh

iOS Developer | Swift | Flutter

More from Medium

apple/swift-evolution 上關於 guard 的有趣討論

iOS: How to upload photos and videos to Firebase Storage

Maegan’s Weekly Stream Links — Issue #3

Preventing Invalid Characters from Being Entered in a UITextField