Function

class_conformsToProtocol(_:_:)

Returns a Boolean value that indicates whether a class conforms to a given protocol.

Declaration

func class_conformsToProtocol(_ cls: AnyClass!, _ protocol: Protocol!) -> Bool

Parameters

cls

The class you want to inspect.

protocol

A protocol.

Return Value

true if cls conforms to protocol, otherwise false.

Discussion

You should usually use NSObject‘s conforms(to:) method instead of this function.