Here's what worked for me (since all other suggestions didn't work in my case). I was getting a segmentation error 11 in a specific Swift class when trying to run unit tests with code inclusion enabled. It turns out that we had a ternary expression on a class property like this:
let cellBorder : CGFloat = MyHelperClass.isIPad() ? 10.0 : 6.0
To do this, lazy var fixed the problem:
lazy var cellBorder : CGFloat = MyHelperClass.isIPad() ? 10.0 : 6.0
To be clear, the code compiled and worked perfectly until we tried to enable code coverage . I also found this Open Radar and this post of the guy who outlined the solution. This seems to be Apple's mistake.
source
share