Describes the protocols adopted by a class.
SDKs
- iOS 2.0+
- macOS 10.5+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Objective-C Runtime
Declaration
func class_copyProtocolList(_ cls: Any Class?, _ outCount: Unsafe Mutable Pointer<UInt32>?) -> Autoreleasing Unsafe Mutable Pointer<Protocol>?
Parameters
cls
The class you want to inspect.
outCount
On return, contains the length of the returned array. If
out
isCount NULL
, the length is not returned.
Return Value
An array of pointers of type Protocol*
describing the protocols adopted by the class. Any protocols adopted by superclasses or other protocols are not included. The array contains *out
pointers followed by a NULL
terminator. You must free the array with free()
.
If cls
adopts no protocols, or cls
is Nil
, returns NULL
and *out
is 0
.