DocC for Swift Package without using an Xcode project?

I previously noticed a few Swift libraries removing their Xcode projects in favour of just keeping a Package.swift. Now that DocC (documentation compiler) is released with Xcode 13, I'm thinking libraries should keep being an Xcode project instead of being a Swift package.

What do you think? There seems to be no way to run DocC without Xcode.

Here's more about DocC: Apple Developer Documentation

You can open Swift packages in Xcode without creating an Xcode project file by opening the Package.swift file or the containing directory in Xcode. You can also use the xcodebuild docbuild command line tool with Swift packages.


DocC works great with Swift Packages in Xcode. For an example, check out the SlothCreator sample. Open the Package.swift file and choose Product > Build Documentation to get started.


Apparently it'll be open sourced later this year


Yes, DocC will be open sourced later this year as part of the Swift project (see the Meet DocC documentation in Xcode session we just posted). We’re excited to work with the Swift community to bring DocC to additional platforms!


Note - for using xcodebuild docbuild on the command line with a Package.swift only setup, you also need to include -scheme, and it helps to explicitly define a -derivedDataPath as well, to make it easier to find the resulting output.

1 Like
Terms of Service

Privacy Policy

Cookie Policy