Just a small update, and i think it should go to the tutorial as well.. 
 Once you define a photoswipe instance, its there... meaning it is present for the whole application. So for example if you would go to a page, load a photoswipe gallery instance, go to some other page and then go back to the page where you loaded the photoswipe, you would get an error stating that there already is an instance of PhotoSwipe and from that point the PhotoSwipe  wont work 
 The solution: 
 Add the following code before you load PhotoSwipe. 
 code 
 var photoSwipeInstance = window.Code.PhotoSwipe.getInstance("name that you gave"); 
 if (typeof photoSwipeInstance != "undefined" && photoSwipeInstance !== null) { 
  window.Code.PhotoSwipe.detatch(photoSwipeInstance); 
 } 
 /code
 
 So it should be something like that: 
 code 
 var photoSwipeInstance = window.Code.PhotoSwipe.getInstance("MyPage"); 
 if (typeof photoSwipeInstance != "undefined" && photoSwipeInstance !== null) { 
  window.Code.PhotoSwipe.detatch(photoSwipeInstance); 
 }
 
 photoSwipeInstance = Apperyio("MyPage").find("ul.gallery a").photoSwipe({}, "MyPage"); 
 /code