Skip to content

Commit 98e1a15

Browse files
committed
Ensure per-phase UIEvent creation in KIF tap simulation
1 parent ea51ab6 commit 98e1a15

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

Sources/KIF/Additions/UIView-KIFAdditions.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -599,13 +599,12 @@ - (void)tapAtPoint:(CGPoint)point;
599599
// Handle touches in the normal way for other views
600600
UITouch *touch = [[UITouch alloc] initAtPoint:point inView:self];
601601
[touch setPhaseAndUpdateTimestamp:UITouchPhaseBegan];
602-
603-
UIEvent *event = [self eventWithTouch:touch];
602+
UIEvent *beganEvent = [self eventWithTouch:touch];
603+
[[UIApplication sharedApplication] kif_sendEvent:beganEvent];
604604

605-
[[UIApplication sharedApplication] kif_sendEvent:event];
606-
607605
[touch setPhaseAndUpdateTimestamp:UITouchPhaseEnded];
608-
[[UIApplication sharedApplication] kif_sendEvent:event];
606+
UIEvent *endedEvent = [self eventWithTouch:touch];
607+
[[UIApplication sharedApplication] kif_sendEvent:endedEvent];
609608

610609
// Dispatching the event doesn't actually update the first responder, so fake it
611610
if ([touch.view isDescendantOfView:self] && [self canBecomeFirstResponder]) {

0 commit comments

Comments
 (0)