Hour 5. Adding Variables to the Calculator
Currently the controller invokes the model to perform each calculation as you type numbers. It would be better if the controller knew less about mathematics, and concentrated on building expressions the Model can evaluate. You’ll use NSScanner to perform simple parsing. You’ll use Cocoa arrays to store the expressions for the calculator’s history. To add variables to the calculator, you’ll learn to use NSDictionary
. Finally you’ll learn about the Key-Value Coding and Key-Value Observing protocols. ...
Get Sams Teach Yourself Cocoa Touch™ Programming in 24 Hours now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.