I’m in the process of building out a custom Swift docker image (heavily based off of the official Swift images) and am noticing a significant number of *.swiftdoc files among all of the module files, largely in the /usr/lib directory (and subdirectories). I’ve tried to find documentation or other forum posts about these files and from what I have been able to find it feels like these aren’t particularly needed by the compiler for building or testing.
Am I able to safely remove these files from the image that I’m building out to save on space? Also, what is the purpose of these files in the first place?
They probably contain Quick Help information? My guess is if *.swiftdoc file is missing for a module, you will be able to compile the project, but you won't get Quick Help for symbols containing in the module when you edit source code that imports such module. Just a guess.
Edit: What Google AI says:
.swiftdoc files in a Swift module contain the compiled documentation for that module. When you compile a Swift module, the Swift compiler extracts documentation comments (those starting with /// or /**) from your source code and compiles them into a binary format stored in the .swiftdoc file.
That’s what I figured, and when I open those they appear to contain exactly those code comments. Was just pretty unsure given that I couldn’t find any official documentation for them