Swift Package Manager: where is the documentation for .testTarget?

I cannot find the documentation for .testTarget. A google search is fruitless. Please help.

It’s here in the documentation in the repository itself, which has been my go‐to source of information for years. But it seems that only one of the three static factories for Target was picked up by whatever parser generated the more recent Apple Developer Documentation.

It seems easiest to link to the doc comment here and there's a generated version here.

1 Like

Cool! I didn’t know the in‐repo markdown docs were rendered into HTML on swift.org. [Edit: That wasn’t intended as a link. Discourse turned it into one. It won’t take you anywhere useful. Click @NeoNacho’s link above instead to see what I was talking about.]

I never new those existed either. Should they be more discoverable?

The github project just seems to talk about the local Documentation directory and Getting Started on swift.org and https://swift.org/package-manager/ doesn't seem to link to it either.

3 Likes

I totally agree that the PackageDescription API docs should be prominently featured, it always takes ages for me to figure out how Package.swift should be written, and Xcode (or SourceKit-LSP for that matter) autocomplete never works for PackageDescription. In the meantime I've created a PR that links to it from README.md.

4 Likes

Oh yes please. The available docs should also include previous SPM versions, because we have semantic versioning constraints which require us to maintain packages whose swift-tools-version is not always the latest. Today, the https://github.com/apple/swift-package-manager repository has no meaningful tag navigation.

2 Likes

Surely we can agree that even that is inadequate? Aside from having to scroll horizontally to read every paragraph, there's nothing that say path must refer to a directory and not a file.

2 Likes

I wasn’t saying it was enough. I was only saying where to find what exists so far.

Sorry, didn’t mean to sound ungrateful. I do appreciate the reference!

1 Like