Back to Browse

How to unit test image assets (iOS)

1.2K views
Apr 13, 2021
20:49

iOS Unit testing in Xcode doesn't need to be difficult. We can add simple unit tests that will help us verify things that the compiler cannot. When using image assets Xcode does not provide us with compiler time checks, which can lead to unwanted UI bugs and even run time crashes. By adding a simple Swift enum and struct we can unit test our image assets to be sure nothing is missing. By using an enum we can write a single test that will check all of our images for us. This is so simple and provides us with a lot of added benefits as our projects change over time and refactor. Link to source code: https://github.com/sparkcode-io/unit-testing-your-images

Download

1 formats

Video Formats

360pmp428.1 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

How to unit test image assets (iOS) | NatokHD