0

I have just upgraded from Xcode 8.3 to Xcode 9.4 and it kept indexing until it crashed, then it output an error.

Swift - Expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions

Is this a bug in Xcode 9 and Swift 4.1?

 let fromString = convenience.getTimeAsString(timeStamp: timeStampDateAndTime, timeFormat: "HH:mm")
    let toString = convenience.getTimeAsString(timeStamp: toTimeStamp, timeFormat: "HH:mm")

   var cellData = "Booking: " + booking.BookingNumber + "\n" + "Area: " + booking.Locality + "\n" + "Postcode: " + booking.PostCode + "\n" + "Time: " + fromString + " - " + toString

How I fixed it?

  var cellData = " \("Booking: ") \(booking.BookingNumber) \("\n") \("Area: ") \(booking.Locality) \("\n") \("Postcode: ") \(booking.PostCode) \("\n") \("Time: ") \(fromString) \(" - ") \(toString) "
bibscy
  • 2,598
  • 4
  • 34
  • 82
  • Possible duplicate of [Swift Compiler Error: "Expression too complex" on a string concatenation](https://stackoverflow.com/questions/29707622/swift-compiler-error-expression-too-complex-on-a-string-concatenation) – John Montgomery Jun 04 '18 at 21:51
  • @JohnMontgomery it's not really a duplicate since I am not using `append` method. Should I report this to Apple? – bibscy Jun 04 '18 at 22:02
  • Both questions are about string concatenation. In any case, I don't know if it would be technically considered a bug or just poor language design, but it's nothing new. – John Montgomery Jun 04 '18 at 22:20

0 Answers0