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.
-
Adds an overridden subclass of a class conforming to the
PTOverridableprotocol.Note
An exception is thrown if none of the subclass’s superclasses conform to the required
PTOverridableprotocol.Declaration
Objective-C
+ (void)addOverriddenClass:(nonnull Class)subclass;Swift
class func addOverriddenClass(_ subclass: AnyClass)Parameters
subclassa subclass to use in place of its superclass
-
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
clsthe class to override, conforming to the
PTOverridableprotocolsubclassthe 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
clsthe original class
Return Value
the overridden subclass, or
Nilif one has not been registered
PTOverrides Class Reference