Swipe to Look?

So I have almost all the controls finished for my game, I’m now looking into swipe to look controls, I couldn’t find much on them really anywhere, so I decided to write my own, and didn’t think they could be that hard. Here’s my code, I don’t now what’s wrong with it, but when using unity remote I don’t even get the first debug.Log to be called. Any help would be greatly appreciated. Here’s the code. In the code I was first working on just the left and right looking, then I’d implement up down to.

var aPosX;
var bPosX;
var moveMag;

function Update () {
for (var i=0; i < iPhoneInput.touchCount; i++){
var touch : iPhoneTouch = iPhoneInput.touches[i];
if(touch.phase == iPhoneTouchPhase.Began){
aPosX = touch.position.x;
Debug.Log(aPosX);
if(touch.phase == iPhoneTouchPhase.Moved){
bPosX = touch.position.x;
Debug.Log(bPosX);
moveMag = aPosX - bPosX;
Debug.Log(moveMag);
}
}
transform.Rotate(0,moveMag,0);
}
}

Oh wow I feel like a complete idiot now. I seemingly forgot to actually add the script to the object. Everything seems to be working now.

Ok heres the almost finished code, the only thing I need now is to have it smoothly rotate, I was looking at slerp but I have no idea how to implement that in my current code. Any help would be awesome.

var aPosX;
var bPosX;
var moveMag;
var moveSpeed : float = 2;
var moveInit : float = 10;

function Update () {
for (var i=0; i < iPhoneInput.touchCount; i++){
var touch : iPhoneTouch = iPhoneInput.touches[i];
if(touch.phase == iPhoneTouchPhase.Began){
aPosX = touch.position.x;
}
if(touch.phase == iPhoneTouchPhase.Moved){
bPosX = touch.position.x;
moveMag = (bPosX - aPosX)/moveSpeed;
moveMag = 0 - moveMag;
transform.Rotate(0,moveMag,0);
}
if(touch.phase == iPhoneTouchPhase.Ended){
moveMag = 0;
}
}
Debug.Log(moveMag);
}