How to automate swipe gestures in iOS 8

I need to automate swipe gesture for both side(Right To Left and Left to Right) in iOS mobile app.

 I am using appium version 1.4.8 , iOS simulator 6 and platform version as 8.3.

 I am writing test cases using java language.

 I have tried with below coding for swipe gestures. But, the swipe action doesn't happens for me.

  public void swipeLeftToRight(AppiumDriver driver) {
      Dimension size = driver.manage().window().getSize();
      int endx = (int) (size.width * 0.8);
      int startx = (int) (size.width * 0.20);
      int starty = size.height / 2;

      driver.swipe(startx, starty, endx, starty, 1000);
  }

  public void swipeRightToLeft(AppiumDriver driver) {
      Dimension size = driver.manage().window().getSize();
      int startx = (int) (size.width * 0.8);
      int endx = (int) (size.width * 0.10);
      int starty = size.height / 2;

      driver.swipe(startx, starty, endx, starty, 1000);
  }

For Android This works fine

public class TouchActions{

public static AndroidDriver<WebElement> _driver;

@BeforeClass
public void setUpAppium() throws InterruptedException, IOException {
	
	DesiredCapabilities capabilities = new DesiredCapabilities();   
	AppCapabilitiesSetUp(capabilities);
	_driver = new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4725/wd/hub"), capabilities);	
}

@Test
public void TouchActionsTest() throws InterruptedException{
	// Wait for first app to launch
	Thread.sleep(10000);
    
	// Press Home Key
	_driver.sendKeyEvent(AndroidKeyCode.HOME);
	Thread.sleep(3000);
           // Press Menu Button
	_driver.findElementByAccessibilityId("Apps").click();
	
	TouchAction tAction=new TouchAction(_driver);
	int startx = _driver.findElement(By.name("Email")).getLocation().getX();
	int starty = _driver.findElement(By.name("Email")).getLocation().getY();
	int endx = _driver.findElement(By.name("Dev Settings")).getLocation().getX();
	int endy = _driver.findElement(By.name("Dev Settings")).getLocation().getY();
	System.out.println(startx + " ::::::: " + starty + " ::::::: " + endx +  " ::::::: " +	endy);
        
            //First tap on the screen and swipe it right using moveTo function
             tAction.press(startx+20,starty+20).moveTo(endx+20,endy+20).release().perform(); 
	
	Thread.sleep(1000);
	
	//Second tap on the screen and swipe it left using moveTo function
	tAction.press(endx+20,endy+20).moveTo(startx+20,starty+20).release().perform();
	
	Thread.sleep(1000);
}

@AfterClass(alwaysRun=true)
public void teardown(){
	_driver.closeApp();
	_driver.quit();
}

public DesiredCapabilities AppCapabilitiesSetUp(DesiredCapabilities cap){
	cap.setCapability(CapabilityType.BROWSER_NAME,"");
	cap.setCapability("platformVersion","4.4.4");
	cap.setCapability("platformName","Android");
	cap.setCapability("deviceName","emulator-5554");
	cap.setCapability("appPackage","appPackage");
	cap.setCapability("appActivity","appActivity");						
	return cap;
	
}

}

@amitjaincoer191 Can you tell me solution for iOS

@amitjaincoer191 @amitjaincoer191 Here is my scenario

Scenario 1:-

  1. There are 20 article in the page
  2. Only 5 articles are displayed. Other articles are displayed when you scroll
  3. How can i scroll with x and y co-ordinates and find an expected article. I want to reach 20th article and click it.
  4. This is list of articles page, Here you see 5 articles are displayed.

Scenario 2:-

  1. Article content is displayed
  2. There are more paragraphs are displayed in an article. In centre of the page , mobile ad(Image) will be displayed.
  3. Mobile Ad(Image) will be displayed only when we scroll to position of centre of an article. I want to verify that image is present or not.
  4. This is a article page, When you scroll, Mobile Ad(image) will be displayed

How can i do it above scenarios?