How Can I Use ITween To Rotate an Object Before Moving

I’m currently using iTween.MoveTo to move my camera from one position to another. I want to rotate the camera 180° before I move the camera.

Here is my code.

   player = Camera.main.transform.parent.gameObject;
    iTween.RotateBy(player,
        iTween.Hash(
            "y", 0.5f,
            "delay", 0.1f,
            "time", 0.1f,
            "easeType", "linear"
        )
    );

    player = Camera.main.transform.parent.gameObject;
    iTween.MoveTo(player,
        iTween.Hash(
            "position", nextPoint.transform.position,
            "time", 3,
            "easetype", "linear"
        )
    );

For some reason the camera moves before it rotates 180° even though the RotateBy statement is before the MoveTo statement.

How do I get this to work?

I believe the code executes in order, but it doesn’t wait for the first iTween function to finish before the next one is called.
You’d probably need to include a callback to MoveTo from inside the hash of the RotateBy. (This would mean putting your MoveTo inside of a different function, that gets called only upon completion of the RotateBy)

 iTween.RotateBy(player,
         iTween.Hash(
             "y", 0.5f,
             "delay", 0.1f,
             "time", 0.1f,
             "easeType", "linear",
             "onComplete", "doMove"
         )
     );

void doMove(){
     iTween.MoveTo(player,
         iTween.Hash(
             "position", nextPoint.transform.position,
             "time", 3,
             "easetype", "linear"
         )
     );
}