3 ms·
> if I suspect a state is impossible to reach, I'll add a fatalError() Does Swift have assert statements? If so, is there a reason you chose this method instea
by uoaei 4y ago
> if I suspect a state is impossible to reach, I'll add a fatalError()
Does Swift have assert statements? If so, is there a reason you chose this method instead?
- allenu 4y agoYes, Swift has assert statements. I tend to use them a lot as well, but in shipping code, they don't terminate the app. There are still some places where I'd prefer to terminate the app early rather than continue on. To be clear, I tend to use assert statements more than fatalErrors.