Please note, this blog entry is from a previous course. You might want to check out the current one.
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 (you’ll need to use the documentation to understand the NSNumberFormatter code). Setting its value to nil should clear the display out.
Make the display value an optional. When getting the display value, check first if there is a text, then if the text is a number and return the double value. Otherwise return nil. When setting the display value, check if it is nil. If not set the text label to the value otherwise to zero.
Continue reading “cs193p – Project #1 Assignment #1 Extra Task #4”