NSObjectProtocol

Undocumented

  • Mechanica

    Exchanges the implementations of two methods given their corresponding selectors.

    To use method swizzling with your Swift classes there are two requirements that you must comply with: 1. The class containing the methods to be swizzled must extend NSObject. 1. The methods you want to swizzle must have the dynamic attribute.

    Note

    In Objective-C you’d perform the swizzling in load() , but this method is not permitted in Swift. But load is a Objective-C only method and cannot be overridden in Swift, trying to do it anyway will result in a compile time error. The next best place to perform the swizzling is in initialize, a method called right before the first method of your class is invoked.

    Declaration

    Swift

    public static func swizzle(method originalSelector: Selector, with swizzledSelector: Selector)

    Parameters

    originalSelector

    Selector for the original method

    swizzledSelector

    Selector for the swizzled methos

  • Mechanica

    Exchanges the implementations of each couple of Selectors. - SeeAlso: swizzle(method:with:)

    Declaration

    Swift

    public static func swizzle(_ selectors: [SwizzlingSelectors])
  • Mechanica

    Returns the type of an object conforming to NSObjectProtocol as String.

    Declaration

    Swift

    public final var type: String
  • Mechanica

    Returns the type of an object instance conforming to NSObjectProtocol as String.

    Declaration

    Swift

    public final static var type: String