Poll: what do you strongly dislike about Swift?

The difficulty of testing fatalError/precondition/assert and other Never returning functions.

Your options are:

  • Never check for preconditions or use assertions
  • Check for preconditions, but leave these edge cases untested
  • Use a platform specific-workaround like CwlPreconditionTesting. For example, it doesn’t work on tvOS, and until recently, didn’t work on M1 macs at all.
  • … or resign to using the error mechanism for preconditions/assertions, causing all your functions to be throws, and thus precipitating an explosion of try.
    • Until recently, this property getters couldn’t be marked throws, and if I'm not mistaken, subscripts still can’t be.
10 Likes