PTOverrides

@interface PTOverrides : NSObject

The PTOverrides class is used to register overridden subclasses of classes defined in the Tools library. Once a class conforming to the PTOverridable protocol has been overridden, whenever an instance of the original class would be created the subclass is used instead.

  • Override the given class with a subclass.

    Declaration

    Objective-C

    + (void)overrideClass:(nonnull Class)cls withClass:(nonnull Class)subclass;

    Swift

    class func overrideClass(_ cls: AnyClass, with subclass: AnyClass)

    Parameters

    cls

    the class to override, conforming to the PTOverridable protocol

    subclass

    the subclass to use in place of the cls

  • Returns the overridden subclass for the given class, if one has been registered.

    Declaration

    Objective-C

    + (nullable Class)overriddenClassForClass:(nonnull Class)cls;

    Swift

    class func overriddenClass(for cls: AnyClass) -> AnyClass?

    Parameters

    cls

    the original class

    Return Value

    the overridden subclass, or Nil if one has not been registered