-5

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

//check popup in window frame

let spaceFromLeftSide = cutOutViewX.constant + cutOutViewWidth.constant/2 - (options.textWidth + padding*2)/2

let spaceFromRightSide = cutOutViewX.constant + cutOutViewWidth.constant/2 + (options.textWidth + padding*2)/2
Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
  • 2
    `try breaking up the expression into distinct sub-expressions` Well, I think it's often a good idea to follow the compiler's suggestions... ;) – Eric Aya Oct 08 '18 at 10:50
  • 3
    How to fix the issue of _extremely bad question titles_, is explained in [ask]. – misorude Oct 08 '18 at 10:58

1 Answers1

1

Problem is that compiler not able to calculate value within time due to complex expression. You need to break these expressions into sub-expressions like this:

let cutOutValue = cutOutViewX.constant + cutOutViewWidth.constant/2
let optionsValue = (options.textWidth + padding*2)/2

let spaceFromLeftSide = cutOutValue - optionsValue
let spaceFromRightSide = cutOutValue + optionsValue

This type of breaking is not only helpful on compilation time but also helpful at debugging time where you can check the current value what variables have.

Incredible_Dev
  • 956
  • 7
  • 13