Defining an Objective-C class introduced the define-objc-class macro with the
:objc-class-name
class option for naming the Objective-C class. Since this macro is like
defclass
, it can specify any number of superclasses from which the Lisp class will inherit and also provides a way for superclass of the Objective-C class to be chosen:
:objc-superclass-name
class option can be used to specify the superclass explicitly.
NSObject
is used as the superclass.
For example, both of these definitions define an Objective-C class that inherits from
MyObject
, via
my-object
in the case of
my-special-object
and explicitly for
my-other-object
:
(define-objc-class my-special-object (my-object)
()
(:objc-class-name "MySpecialObject"))
(define-objc-class my-other-object ()
()
(:objc-class-name "MyOtherObject")
(:objc-superclass-name "MyObject"))
The set of methods available for a given Objective-C class consists of those defined on the class itself as well as those inherited from its superclasses.