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

			return
		}

		let viewSize = view.bounds.size

		var childViewFrame = CGRect()
		childViewFrame.left = CGFloat(childView.index) * viewSize.width
		childViewFrame.size = viewSize
		childView.frame = childViewFrame
	}


		ignoresScrollViewDidScroll += 1
		defer { ignoresScrollViewDidScroll -= 1 }

		let scrollViewFrame = CGRect(size: view.bounds.size).insetBy(scrollViewInsets)
		let contentSize = CGSize(width: CGFloat(viewControllers.count) * scrollViewFrame.width, height: scrollViewFrame.height)

		let contentOffset = scrollView.contentOffset
		scrollView.frame = scrollViewFrame
		childContainer.frame = CGRect(size: contentSize)
		scrollView.contentSize = contentSize
		scrollView.contentOffset = contentOffset
