protocol_addMethodDescription(_:_:_:_:_:)
Adds a method to a protocol.
Declaration
func protocol_addMethodDescription(_ proto: Protocol, _ name: Selector, _ types: UnsafePointer<CChar>?, _ isRequiredMethod: Bool, _ isInstanceMethod: Bool)Parameters
- proto:
The protocol you want to add a method to.
- name:
The name of the method you want to add.
- types:
A C string representing the signature of the method you want to add.
- isRequiredMethod:
A Boolean indicating whether the method is a required method of the
protoprotocol. If Yes, the method is a required method; if No, the method is an optional method. - isInstanceMethod:
A Boolean indicating whether the method is an instance method. If Yes, the method is an instance method; if No, the method is a class method.
Discussion
To add a method to a protocol using this function, the protocol must be under construction. That is, you must add any methods to proto before you register it with the Objective-C runtime (via the objc_registerProtocol(_:) function).
See Also
Working with Protocols
objc_getProtocol(_:)objc_copyProtocolList(_:)objc_allocateProtocol(_:)objc_registerProtocol(_:)protocol_addProtocol(_:_:)protocol_addProperty(_:_:_:_:_:_:)protocol_getName(_:)protocol_isEqual(_:_:)protocol_copyMethodDescriptionList(_:_:_:_:)protocol_getMethodDescription(_:_:_:_:)protocol_copyPropertyList(_:_:)protocol_getProperty(_:_:_:_:)protocol_copyProtocolList(_:_:)protocol_conformsToProtocol(_:_:)