Beginner lessons on setting up unit testing in Swift.
On Creation
Easiest way is during project creation. When creating a new project simply tick the checkbox Include Tests.

This should create the basic bundle code and targets.
There are two types unit testing. UI Unit Testing and Unit Testing

Existing Project
If you have an existing project and you want to start adding Unit test. Do the following.
Go to File > New > Target and select Unit Testing Bundle and hit Next then Finish.

Repeat same steps this time select UI Unit Testing Bundle.
Note: Rookie mistake for me was I directly created a new file Unit Testing file which created a file but throws an error as the target was missing.
No such module 'XCTest'