Changes between Version 13 and Version 14 of AppleCurrencyConverterWritingLisp


Ignore:
Timestamp:
Jan 19, 2008, 3:57:57 PM (12 years ago)
Author:
mikel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AppleCurrencyConverterWritingLisp

    v13 v14  
    6565means that the type of the object that receives the convertCurrency:atRate: message is Converter.
    6666
    67 You will see these same conventions repeated in the next section.
     67You'll see these same conventions repeated in the next section.
    6868
    6969== Defining the !ConverterController Class ==
    7070
     71The previous section defined the Model class, Converter. All we need now is a definition for the !ConverterController class. Recall from your reading of Apple's Tutorial that the !CurrencyConverter example uses the Model-View-Controller paradigm. You used !InterfaceBuilder to construct the application's views. The Converter class provides the model that represents application data. Now we define the controller class, !ConverterController, which connects the View and the Model.
    7172
     73Here's the Lisp definition of the ConverterController class:
     74
     75{{{
     76(defclass converter-controller (ns:ns-object)
     77  ((amount-field :foreign-type :id :accessor amount-field)
     78   (converter :foreign-type :id :accessor converter)
     79   (dollar-field :foreign-type :id :accessor dollar-field)
     80   (rate-field :foreign-type :id :accessor rate-field))
     81  (:metaclass ns:+ns-object))
     82}}}
     83
     84Once again we use the Objective-C bridge to define an Objective-C class. This time, we provide several instance-variable definitions in the class. We also explicitly define the names of accessor functions for each of them. The :FOREIGN-TYPE initargs enable us to specify the types of the fields in the foreign (Objective-C) class.
    7285
    7386[AppleCurrencyConverter Start] [AppleCurrencyConverterCreatingaLispFile Previous]