We paid attention to a talk that is incredible by Andy Matuschak whom labored on UIKit in which he describes why the UIKit team utilized this certain way of managing gestures over other conventional approaches such as for instance is employed in respond.js.
I would suggest investing the right time for you listen or view this talk.
Whenever a pan motion starts several various things have actually to take place. Such as for example determining the initialTouchPoint, a CGPoint representing in which an individual first began their pan from the display into the system that is coordinate of SwipeableView . It is utilized to determine an anchor that is new, that may quickly be set whilst the SwipeableViewвЂ™s layerвЂ™s anchorPoint.
UIKit defines the anchorPoint as a spot for which all transformations that are geometric applied in accordance with. By standard the anchorPoint for many UIViews may be the precise center associated with view CGPoint(x: 0.5, y: 0.5) .
All geometric manipulations to the view happen about the specified point. As an example, using a rotation transform to a layer because of the standard anchor point causes the layer to turn around its center. (more…)