 			return
 		}
 
-		let viewSize = view.bounds.size
+		let containerSize = scrollView.bounds.size
 
 		var childViewFrame = CGRect()
-		childViewFrame.left = CGFloat(childView.index) * viewSize.width
-		childViewFrame.size = viewSize
+		childViewFrame.left = CGFloat(childView.index) * containerSize.width
+		childViewFrame.size = containerSize
 		childView.frame = childViewFrame
 	}
 

				var closestChildOffset = CGFloat(0)
				var closestDistanceToHorizontalCenter = CGFloat.greatestFiniteMagnitude

				if !previousViewSize.isEmpty {
					let previousHorizontalCenter = contentOffset.left + (previousViewSize.width / 2)
					for subview in childContainer.subviews {
						guard let childView = subview as? ChildView, childView.index >= 0 else {
							continue


	fileprivate var ignoresScrollViewDidScroll = 0
	fileprivate var isSettingPrimaryViewControllerInternally = false
	fileprivate var lastLayoutedScrollViewInsets = UIEdgeInsets.zero
	fileprivate var lastLayoutedScrollViewInsetsForChildren = UIEdgeInsets.zero
	fileprivate var lastLayoutedScrollViewSizeForChildren = CGSize.zero
	fileprivate var lastLayoutedSizeForChildren = CGSize.zero
	fileprivate var lastLayoutedSize = CGSize.zero
	fileprivate var reusableChildView: ChildView?
	fileprivate var scrollCompletion: ScrollCompletion?
	fileprivate var viewControllersNotYetMovedToParentViewController = [UIViewController]()
