Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
Sharing Constants
All of the constants that you have used so far
you have put into Constants.swift.
It would have been technically possible to add each of these constants
to the top of the test file that you used them in.
However, as you have already seen,
it is quite common to use the same constants
in multiple tests and in multiple test files.
On the one hand, if you do not put constants in the files
where they are first used,
they will be visible from other test files –
so long as you do not mark them private.
On the other hand, if you follow this approach,
your shared constants will be scattered throughout your test files
and harder to track down.
For this reason, stylish Swift programmers put their shared test constants into a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access