Thanks Aaina for pointing the stuff. Yes, we should not have an assertion in the else block for the following reasons:

  • If the value of that attribute is necessary then, it should never be nil
  • As per my code, I am already checking that the attributes should not be nil. So it does not make sense to re-test again when its already is a XCTFailed() case.

So it should be a failed test rather than any other assertions. I have updated the code. :)



Software Developer(iOS), Speaker & Writer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store