Adding Unit Tests to an Existing iOS Project (SwiftUI / UIKit)

Опубликовано: 19 Апрель 2021
на канале: Sparkcode
3,236
59

This is a quick video demonstrating how to add a unit testing bundle to an existing Xcode project. The process is simple but has a few gotcha's to look out for.

Use @testable import in order to import your app module
If your project has a space in its name then the generated module will replace spaces with underscores. My Project will become My_Project
Make sure your unit test bundle is in your app scheme's "Test" section

There is no difference in unit testing between a SwiftUI project and a UIKit project, they both integrate unit tests in the same way.