My favourite solution to this is to allow tests in the same scope of the function (as previously mentioned by someone like D does). Though it is quite a big language feature to implement which I don't even know if Swift wants, and if so it might even need to move away from XCTest...
Edit: It seems like @codafi went ahead and did a full proposal just minutes before I wrote this