         if (useLargestChild && (widthSpec == .AtMost || widthSpec == .Unspecified)) {
             totalLength = 0
             
-            for var i = 0; i < count; i++ {
-                guard let child = getVirtualChildAt(i) else {
-                    totalLength += measureNullChild(i)
+            var measureIdx1: Int = 0
+            while (measureIdx1 < count) {
+                guard let child = getVirtualChildAt(measureIdx1) else {
+                    totalLength += measureNullChild(measureIdx1)
+                    measureIdx1 += 1
                     continue
                 }
                 
                 let lp = child.layoutParams
                 
                 if (lp.hidden) {
-                    i += getChildrenSkipCount(child, index: i)
+                    measureIdx1 += getChildrenSkipCount(child, index: measureIdx1) + 1 // combined with measureIdx1++
                     continue
                 }
                 

                child.frame = CGRectMake(childLeft, childTop + getLocationOffset(child), childWidth, childHeight)
                childTop += childHeight + lp.marginBottom + getNextLocationOffset(child)
                
                i += getChildrenSkipCount(child, index: i)
            } else {
                child.frame = CGRectZero
            }
        }
    }
    

                }
                
                if (isExactly) {
                    totalLength += childWidth + lp.marginAbsLeft + lp.marginAbsRight + getNextLocationOffset(child)
                } else {
                    let total = self.totalLength
                    self.totalLength = max(total, total + childWidth + lp.marginAbsLeft + lp.marginAbsRight + getNextLocationOffset(child))
