Function

protocol_addProperty

Adds a property to a protocol that is under construction.

Declaration

void protocol_addProperty(Protocol *proto, const char *name, const objc_property_attribute_t *attributes, unsigned int attributeCount, BOOL isRequiredProperty, BOOL isInstanceProperty);

Parameters

proto

The protocol you want to add a property to.

name

The name of the property you want to add.

attributes

An array of property attributes.

attributeCount

The number of properties in attributes.

isRequiredProperty

A Boolean indicating whether the property’s accessor methods are required methods of the proto protocol. If YES, the property’s accessor methods are required methods; if NO, the property’s accessor methods are optional methods.

isInstanceProperty

A Boolean indicating whether the property’s accessor methods are instance methods. If YES, the property’s accessor methods are instance methods. YES is the only value allowed for a property. As a result, if you set this value to NO, the property will not be added to the protocol.

Discussion

The protocol you want to add the property to must be under construction—allocated but not yet registered with the Objective-C runtime (via the objc_registerProtocol function).

See Also

Working with Protocols

objc_getProtocol

Returns a specified protocol.

objc_copyProtocolList

Returns an array of all the protocols known to the runtime.

objc_allocateProtocol

Creates a new protocol instance.

objc_registerProtocol

Registers a newly created protocol with the Objective-C runtime.

protocol_addMethodDescription

Adds a method to a protocol.

protocol_addProtocol

Adds a registered protocol to another protocol that is under construction.

protocol_getName

Returns a the name of a protocol.

protocol_isEqual

Returns a Boolean value that indicates whether two protocols are equal.

protocol_copyMethodDescriptionList

Returns an array of method descriptions of methods meeting a given specification for a given protocol.

protocol_getMethodDescription

Returns a method description structure for a specified method of a given protocol.

protocol_copyPropertyList

Returns an array of the properties declared by a protocol.

protocol_getProperty

Returns the specified property of a given protocol.

protocol_copyProtocolList

Returns an array of the protocols adopted by a protocol.

protocol_conformsToProtocol

Returns a Boolean value that indicates whether one protocol conforms to another protocol.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software