Actually things are based on approximations.
So if I say we have a app Page with an element on top of page and one on bottom of page
elememt.top of page.getX - startX
element.top of page.getY - start Y
element.bottom of page.getX - end X
element.bottom of page.getY - end Y
so depending on coordinates passed swipe or scroll will happen
driver.swipe(0,0,300,0) - this will scroll horizontally right
driver.swipe(300,0,100,0) - this will scroll horizontally left
driver.swipe(0,0,0,300) - this will scroll vertically down
driver.swipe(100,500,100,100) - this will scroll vertically up
same way touchactions also work.
I have seen u r other question also so if you want to use loop to scroll to bottom then u can use loop but u must have a terminating condition for loop ....
I have example from android app context in case u r interested I can post it.
I worked less on iOS app but what ever worked I found that absolute xpath returned by inspector very less reliable. so depend on other strategy like classname,relative xpath etc