Defines an Objective-C formal protocol.
objc
define-objc-protocol name &key incorporated-protocols instance-methods class-methods
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. |
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:
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.
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.
LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual - 01 Dec 2021 19:38:32