In Swift, optionals are one of the most important features for handling missing or undefined values. Swift is designed to be safe, and optionals are a key part of that…