I have a large data model in which the objects need to be hashable for comparision. for that I added hashValue getters to them, like this:
var hashValue:Int
{
let h1 = (31 &* id.hashValue)
&+ caseID.hashValue
&+ statusID.hashValue
&+ assignedToID.hashValue
let h2 = h1 &+ runID.hashValue
&+ templateID.hashValue
&+ typeID.hashValue
&+ priorityID.hashValue
let h3 = h2 &+ milestoneID.hashValue
&+ customOS.description.hashValue
&+ title.hashValue
&+ estimate.hashValue
&+ estimateForecast.hashValue
let h4 = h3 &+ refs.hashValue
&+ customAutomated.hashValue
&+ customPreconds.hashValue
let h5 = h4 &+ customSteps.hashValue
&+ customExpected.hashValue
let h6 = h5 &+ customMission.hashValue
&+ customGoals.hashValue
&+ customLabel.description.hashValue
let h7 = h6 &+ customSteps.hashValue
&+ customStepsSeparated.description.hashValue
return h7
If the model object had too many properties I broke them down as above. This went well until I covered several more model classes with the same treatment. Now with approx. 10 model classes that are hashable the compile time went from one minute to 10 minutes after which the compilation fails completely with the following error(s):
Error:unable to execute command: Killed: 9
Error:compile command failed due to signal 9 (use -v to see invocation)
Error:Build failed with 0 errors and 97 warnings in 14m 34s 489ms
What can I do to prevent this? I'm using Swift 4 and Xcode 9.2.