Change the computed instance variable displayValue to be an Optional Double rather than a Double. Its value should be nil if the contents of display.text cannot be interpreted as a Double. Setting its value to nil should clear the display out. You’ll have to modify the code that uses displayValue accordingly.
Excerpt from CS193P iOS Application Development Spring 2016 Project 1 assignment sheet. (C) 2016 Stanford University
Description