I had my app running properly, but on my setting VC I was using a lot of if indexPath.row == aGivenRowNumber{ ...}
, I try to refactor it using a switch indexPath.row {...}
, but now the app start crashing with this error: 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [75.75 nan]'
which from what I read happens when you have a divide by zero in the code, however my app was working just fine before I try doing the switch
. This is not the first time it is happening, last time I tried using the switch pattern in TableViewController same thing happened but I couldn't make the connection with the switch
pattern then. But this time around, refactoring from if ...then
to switch ... case
is the only thing I did as I started working. Can anybody tell me what this is happening and how to fix the problem now? I am using swift and Xcode 7.2
Thank you
edit: I tried to revert back to the previous working state using version control, but the app just keeps crashing now
update: It looks like when I load the app on the physical device it works fine. So, maybe this is a problem with the simulator ... but I don't know if putting back the switch statement will make it crash on the device as well, I don't want to try...