Troy
Troy

Reputation: 21892

What is the Swift equivalent of UIGestureRecognizerStateEnded?

I'm trying to detect when a pan gesture ends. Under Objective-C, I would do something like the following:

- (void)panGesture:(UIPanGestureRecognizer *)gesture {
    if (gesture.state == UIGestureRecognizerStateEnded) {
        ...
    }
}

In my Swift project, it doesn't recognize UIGestureRecognizerStateEnded... Maybe I just need to import something different(?)

Upvotes: 1

Views: 1769

Answers (1)

dasdom
dasdom

Reputation: 14063

The equivalent is just

gesture.state == .Ended

or if you like

gesture.state == UIGestureRecognizerState.Ended

Upvotes: 8

Related Questions