NextPrevUpTopContentsIndex

define-objc-class-method

Macro
Summary

Defines an Objective-C class method for a specified class.

Package

objc

Signature

define-objc-class-method ( name result-type [ result-style ]) ( object-argspec argspec *) form *

object-argspec ::= ( object-var class-name [ pointer-var ])

argspec ::= ( arg-var arg-type [ arg-style ])

Arguments

name

A string naming the method to define.

result-type

An Objective-C FLI type.

result-style

An optional keyword specifying the result conversion style, either :lisp or :foreign .

object-var

A symbol naming a variable.

class-name

A symbol naming a class defined with define-objc-class.

pointer-var

An optional symbol naming a variable.

arg-var

A symbol naming a variable.

arg-type

An Objective-C FLI type.

arg-style

An optional symbol or list specifying the argument conversion style.

form

A form.

Description

The macro define-objc-class-method defines the Objective-C class method name for the Objective-C classes associated with class-name . The name should be a concatenation of the message name and its argument names, including the colons, for example "setWidth:height:" .

If the define-objc-class definition of class-name specifies the (:objc-class-name objc-class-name ) option, then the method is added to the Objective-C class objc-class-name . Otherwise, the method is added to the Objective-C class of every subclass of class-name that specifies the :objc-class-name option, allowing a mixin class to define methods that become part of the implementation of its subclasses (see Abstract classes).

When the method is invoked, each form is evaluated in sequence with object-var bound to the (sub)class of class-name , pointer-var (if specified) bound to the receiver foreign pointer to the Objective-C class and each arg-var bound to the corresponding method argument.

See define-objc-method for details of the argument and result conversion.

The form s can use functions such as invoke to invoke other class methods on the pointer-var . The macro current-super can be used to obtain an object that allows class methods in the superclass to be invoked (like super in Objective-C).

Example
See also

define-objc-class
define-objc-method
current-super


LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual - 4 Apr 2005

NextPrevUpTopContentsIndex