Don't Forget "Autocreate Schemes Now"

This is just a short post documenting something I've run into a couple times in jumping around to multiple Xcode 14.3 projects with Swift Packages as shared frameworks.

When adding a new library/target to a Package.swift shared library, the library's scheme jumps right into the Xcode project.

A screenshot of Xcode showing a sample entry of a matching library and target in a Swift Package Swift file

If you then add a sibling test target for the same library to the Package.swift, maybe before you have the directory for it, or piecemeal sometime later:

A screenshot of Xcode showing a sample entry of a matching test target in a Swift Package Swift file

... it can create a standalone scheme, instead of automagically combining them together:

A screenshot showing the Xcode Scheme Manager with two top-level targets of sample-lib and sample-libTests

What if you wanted to build/test and keep just the main library scheme selected? Basically merge the sample-lib and sample-libTests schemes?

Instead of wading in too deep to the Scheme Manager manually and figuring out how to edit them into one scheme (which I'm sure someone is an expert at), simply:

  1. Choose Product -> Scheme -> Manage Schemes
  2. Delete both schemes (sample-lib and sample-libTests)
  3. In the same dialog, choose "Autocreate Schemes Now"
A screenshot showing the Xcode Scheme Manager with one top-level target of sample-lib containing sample-libTests

Even though Autocreate Schemes is already checked, you just need to nudge it. Exactly what I wanted, quick.