Contents

class_respondsToSelector(_:_:)

Returns a Boolean value that indicates whether instances of a class respond to a particular selector.

Declaration

func class_respondsToSelector(_ cls: AnyClass?, _ sel: Selector) -> Bool

Parameters

  • cls:

    The class you want to inspect.

  • sel:

    A selector.

Return Value

YES if instances of the class respond to the selector, otherwise NO.

Discussion

You should usually use NSObject’s responds(to:) or instancesRespond(to:) methods instead of this function.

See Also

Working with Classes