Home > Mobile >  Rhombus next to SPM test function disappears in Xcode 14
Rhombus next to SPM test function disappears in Xcode 14

Time:12-17

I have started recently working on the modularisation of an personal old Xcode project by using Swift packages and I have realised that the rhombus next to the test functions are constantly disappearing.

enter image description here

At first, I thought that I had set the schemes wrongly but then I realised that when I restart Xcode then I can see them again.

enter image description here

Forgive me I add the wrong tag because I am not sure if the question is related to SPM or Xcode 14 but, in my company, we have a project using the same modularisation pattern and it works fine. The only thing is that we are still using Xcode 13.

CodePudding user response:

Yes, I've seen this. It is often caused by a mistake in the test case file, such as a missing curly brace, or duplicate test method names. Xcode is particularly prone to difficulties if you copy an entire test method, paste it, and then change its name; the issue is that for a moment, two tests methods had the same name, and that drives Xcode a little crazy.

Another way to cause this problem is to change Git branches when Xcode has the project open. Xcode hates that — even if you use Xcode itself to switch between branches. Always close your project, or even better quit Xcode, before switching branches.

Your solution of closing the project and opening it again is pretty good. Even better: quit Xcode and delete DerivedData. It's a good idea to do this once a week or so in any case.

  • Related