Introduction
Optionals help Swift avoid mistakes by making it clear when a value might be missing. This keeps your app safe from crashes.
When a value might not exist, like a user's middle name.
When reading data that could be missing, like a file or network response.
When a function might not return a value, like searching for something.
When you want to handle missing information safely instead of crashing.