How to unit test image assets (iOS)

Опубликовано: 13 Апрель 2021
на канале: Sparkcode
1,034
7

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-...