CLUTouch

@interface CLUTouch : NSObject

@brief CLUTouch is a proxy for UITouch data and properties dictionary generator for this data.

@discussion CLUTouch is a data model to store UITouch’s data in appropriate way. Since the system reuse UITouch object with each user interaction we can’t just store in in out collection in order to generate their properties data dictionary (via UITouch category) and add this data to final report file. Instead we have to transfer UITouch values to our custom class CLUTouch and interaction with it.

Used in CLUGeneralGestureRecognizer in order to transfer UITouch to CLUTouch. Also CLUInteractionObserverDelegate protocol requires CLUTouch instead of UITouch

  • The current location of the touch in the coordinate system of the screen

    Declaration

    Objective-C

    @property (readonly, nonatomic) CGPoint locationInWindow;

    Swift

    var locationInWindow: CGPoint { get }
  • Amount of touch down within a certain point within a certain amount of time

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSInteger tapCount;

    Swift

    var tapCount: Int { get }
  • Create new instance of CLUTouch object with data from UITouch object

    Declaration

    Objective-C

    - (instancetype)initWithTouch:(UITouch *)touch;

    Swift

    init!(touch: UITouch!)

    Parameters

    touch

    system generated UITouch object (usually from touchBegan: touchMoved: or touchEnded: methods)

    Return Value

    CLUTouch instance with data from UITouch object

  • Generate serialized properties dictionary with all required values there locationInWindow and tapCount To use this dictionary in final report writing process

    Declaration

    Objective-C

    - (NSDictionary *)properties;

    Swift

    func properties() -> [AnyHashable : Any]!

    Return Value

    dictionary with properties of CLUTouch