How to do a circle gesture (press+hold+move) in JS

Hello all,

I am new to Appium and use it for iOS app automation.

Appium version : 1.2.0-beta. 3
Programming language : Javascript

The elements (rectangles, circle, cursor) of my iOS app are generated using Core Graphics (UIView). I need to press a cursor using appium with the coordinates defined. Then i have to hold the cursor and make a circle movement. Basically i have to move the cursor along a circle. I’ve written a interpolation function to move the cursor along the circumference of the circle:

function SwipeCircle (centerX, centerY, radius, startDegree, degrees, steps) {
   //interpolate along the circumference of the circle
  let angle = degrees / steps;
  let prevX = 50; 
  let prevY = 230;
  var gesture = new TouchAction(driver);, prevY);

  for (i=1; i < steps; ++i) {
    let newX = centerX + radius * Math.Cos((startDegree + angle * i) * Math.PI / 180);
    let newY = centerY + radius * Math.Sin((startDegree + angle * i) * Math.PI / 180);
    let difX = newX - prevX;
    let difY = newY - prevY;
    gesture.moveTo(difX, difY);
    prevX = newX;
    prevY = newY;

This is not working. The cursor doesn’t even move a bit.
I’ve also tested it with swipe, but the cursor is also not moving.

await (new TouchAction(driver))
  .press( {  })
  .moveTo({  })
  .moveTo({  })
  .moveTo({  })
  .moveTo({  })
  .moveTo({  })
  .release({  })
  .perform(  )

Is there any simple solution for the circle movement? Can someone help me to do this gesture?

Thanks in advance


Even i need to know how to perform circular gesture. I need to move the spindle in a circular direction in pie graph.

Can someone help regarding this?

Thanks in advance