Refactor swipe event.