All Manuals > LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual > 2 Objective-C Reference

define-objc-protocol Macro

Summary

Defines an Objective-C formal protocol.

Package

objc

Signature

define-objc-protocol name &key incorporated-protocols instance-methods class-methods

Arguments
name
A string naming the protocol to define.
incorporated-protocols
A list of protocol names.
instance-methods
A list of instance method specifications.
class-methods
A list of class method specifications.
Description

The macro define-objc-protocol defines an Objective-C formal protocol named by name for use in the :objc-class-protocols option of define-objc-class.

If incorporated-protocols is specified, it should be a list of already defined formal protocol names. These protocols are registered as being incorporated within name. The default is for no protocols to be incorporated.

If instance-methods or class-methods are specified, they define the instance and class methods respectively in the protocol. Each should give a list of method specifications, which are lists of the form:

(name result-type arg-type*)

with components:

name
A string naming the method. name should be a concatenation of the message name and its argument names, including the colons, for example "setWidth:height:".
result-type
The Objective-C FLI type that the method returns.
arg-type
The Objective-C FLI type of the corresponding argument of the method.

The receiver and selector arguments should not be specified by the arg-types. All the standard Cocoa Foundation and Application Kit protocols from the macOS 10.4 SDK are predefined by LispWorks.

Notes

It is not possible to define new protocols entirely in Lisp on macOS 10.5 and later, but define-objc-protocol can be used to declare existing protocols.

See also

define-objc-class


LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual - 01 Dec 2021 19:38:32