Posts

Post marked as unsolved
74 Views

The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions

Build fail with Swift Compiler Error: The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions on line 9 in code section below (line 150 in BBPMainController.swift). I have tried to comment out sections and line 150 together with expressions where aboveAlpha is used and it does the trick. Have been unable to understand why and would appreciate brighter eyes to help out. BBPMainController.swift - https://developer.apple.com/forums/content/attachment/96c2ba15-9909-44af-98be-4d68f785a8b4 func scrollViewDidScroll(_ scrollView: UIScrollView) { // -- Update overlayer alpha value -- let maxAlphaValue: CGFloat = 0.75 // Calcuate alpha let aboveAlpha = 0 - (maxAlphaValue - maxAlphaValue * ((scrollView.contentOffset.y - view.bounds.height) / view.bounds.height)) + maxAlphaValue * 2 let belowAlpha = maxAlphaValue - maxAlphaValue * ((scrollView.contentOffset.y - view.bounds.height) / view.bounds.height) + maxAlphaValue // Set alpha or 0 if alpha is greater than 1 applocationScrollOverlayerAboveView.alpha = aboveAlpha 1 ? 0 : max(0, min(1, aboveAlpha)) applocationScrollOverlayerBelowView.alpha = belowAlpha 1 ? 0 : max(0, min(1, belowAlpha)) // -- Update transform scale and view alpha value -- let minScaleValue: CGFloat = 0.6 let scale: CGFloat if aboveAlpha 1 { scale = ((scrollView.contentOffset.y - view.bounds.height * 2) / view.bounds.height) * minScaleValue + abs(minScaleValue - 1) } else { scale = 0 - ((scrollView.contentOffset.y - view.bounds.height) / view.bounds.height) * minScaleValue + abs(minScaleValue - 1) } applicationController.view.transform = CGAffineTransform(scaleX: scale, y: scale) applicationController.view.alpha = max(0, min(1, scale)) }
Asked
Last updated .