A Spritekit Framework Protocol Based to make our lives easier handling gestures and motion
- Copy the "GestureManagement" group to your project
- Create Subclasses of your SKNodes (See examples in prroject)
- Create your GameScene as subclass of HandledGestureSKScene
- Conform your nodes with the new Protocols listed below as you need
-
protocol TouchableSKNode
- Just mark your node as touchable
-
protocol TapableSKNode
- Mark your node as able to receive TAP gesture
-
protocol TapableToogleSelectedSKNode
- Executes func toogleSelected() on single tap
-
protocol PannableSKNode
- Handles PAN gesture, moving node
-
protocol PannableLimitInScreenSKNode
- Make the node return to first full visible position at end of PAN
-
protocol PannableRemoveOutScreenSKNode
- remove node from Scene if invisible at the end of TAP
-
protocol PannableHaveInertia
- Execute PAN inertia movement depending on pan velocity and friction parameter
-
protocol ScalableSKNode
- Make node Pinch Scalable
-
protocol ScalableFitScrenSKNode
- Reduce to Fit node in scene at the end of scale, if result is a node bigger than scene
-
protocol ScalableFillScrenSKNode
- Reduce to Fill node in scene at the end of scale, if result is a node bigger than scene
-
UITouch & Set extensions
- func firstTouchedNode(of type:T.Type, in node:SKNode)->T? Returns first touched node of this UITouch of a Given Type or the root node of this query
-
UIGestureRecognizer extensions
- firstTouchedNode:SKNode? Returns first touched node of this UIGestureRecognizer
- orientedLocation: CGPoint Returns correct Y signal location
- firstTouchedNode(of type:T.Type)->T? Returns first touched node of this UIGestureRecognizer of a Given Type or the root node of this query
-
SKNode extensions
- pulse(_ times:Int = 1, duration: TimeInterval = 0.1) Run a pulse animation
- scaleValueToFitScreen:CGFloat
- scaleValueToFillScreen:CGFloat
- proportionToScreen:CGPoint
- isOffScene:Bool
- isFullOffScene:Bool
- removeFromParentIfOffScene()
- bounceBackIfOffScreen()
- frameInScene:CGRect A frame representant in adjusted to the scene