Please note, this blog entry is from a previous course. You might want to check out the current one.
The extra credit item from last week to turn displayValue into a Double? (i.e, an Optional rather than a Double) is now required. displayValue should return nil whenever the contents of the display cannot be interpreted as a Double. Setting displayValue to nil should clear the display.
… done that, too. However, hint #1 asks to consider using optional chaining, which we did not up to now.
Assuming there is always a text string, and that we handle the internationalization problem elsewhere, we can reduce the getter of displayValue to a single line using optional chaining:
return NSNumberFormatter().numberFromString(display.text!)?.doubleValue
The complete code for the task #4 is available on GitHub.