         
         return cell
     }
-    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
-        //TODO: タップ時
+    
+    func scrollViewDidScroll(_ scrollView: UIScrollView) {
+        if scrollView.contentOffset.x + scrollView.frame.size.width > scrollView.contentSize.width && scrollView.isDragging && !isUpdating {
+            if isNext {
+                page_id += 1
+                isUpdating = true
+                CallGetCompareAPI()
+            }
+        }
     }
-
+    
     override func didReceiveMemoryWarning() {
         super.didReceiveMemoryWarning()
     }

    var user_id = 0
    var page_id = 1
    var movies: [MovieCompare.Data] = []
    
    override func viewDidLoad() {
        super.viewDidLoad()

        let keychain = Keychain()
        user_id = Int((try! keychain.get("id"))!)!
        
        InitCollectionView()
        CallGetCompareAPI()
    }
    
