Automation of pull to refresh functionality of tableview in IOS

I am trying to automate the pull to refresh functionality of table view. i am unable to do it.

Here is the snippet i have used.

JavascriptExecutor js = (JavascriptExecutor) driver.;
HashMap scrollObject = new HashMap();
scrollObject.put(“direction”, “up”);
scrollObject.put(“element”, (element).getId());
js.executeScript(“mobile: scroll”, scrollObject);
js.executeScript(“mobile: scroll”, scrollObject);

Are u trying to swipe the screen up or down ? for iOS/Android app ??

I trying to swipe Down. Here is my Use case.

i want to hold one elements , drag downwards and release it.

find the el1 as the upper end element and el2 for the lower end element
TouchAction().press(el1).moveTo(el2).release()
in case if you can use
TouchAction().press(el1).moveTo(x,y).release()
where x y is with respect to el1.

I tried this and it worked for me

//Get the size of screen.
size = andoDriver.manage().window().getSize();
//Find swipe start and end point from screen’s width and height.
//Find starty point which is at bottom side of screen.
int starty = (int) (size.height * 0.90);
//Find endy point which is at top side of screen.
int endy = (int) (size.height * 0.20);
//Find horizontal point where you wants to swipe. It is in middle of screen width.
int startx = size.width / 2;
System.out.println("starty = " + starty + " ,endy = " + endy + " , startx = " + startx);
//Swipe from Bottom to Top. driver.swipe(startx, starty, startx, endy, 3000);
Thread.sleep(10000);
//Swipe from Top to Bottom.
andoDriver.swipe(startx, endy, startx, starty, 3000);

But now I am looking for how to verify if the loader was shown.

@Jeevesh did you find solution to wait for loader ? Please share

Thanks,
Vikram

driver.swipe(165, 235, -2, 103, 0);//swipe up to down