Hi,
My app was working fine, and then I did a minor update of an asset, built it, tested it in Debug Mode, uploaded to TestFlight, and now my testers report a systematic crash.
I built using Xcode 7.1B3
Long story short, a call to sortInPlace now crashes deep inside it:
class CourseEvent : CustomDebugStringConvertible {
var Date: String = "0"
<...>
}
var courseArray : [CourseEvent]
<...>
courseArray.sortInPlace {$0.Date <= $1.Date}
Where:
- courseArray indeed is a valid array of CourseEvent objects, which has, among others, a property named "Date". I checked the array is not corrupt, nor empty
- the call doesn't crash in the Debug configuration, only in the Release configuration
- the crash happens on the device as well as the simulator, with no difference that I could see
- the same code didn't crash in an earlier build, though I can't remember which exact version of Xcode I was using (but definitely the Xcode 7 family, since I am using Swift 2.0).
I have a workaround, as the following doesn't crash:
courseArray = courseArray.sort {$0.Date <= $1.Date}
So, is the bug mine, or is there a bug in Swift's sortInPlace? Should I spent the time to reduce it and file a bug report?
Thanks,
JD