Tool to generate the Swift interface for a compiled module

Originator:jlieske
Number:rdar://17839032 Date Originated:28-Jul-2014 10:47 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Version 6.0 (6A267n)
Classification: Reproducible:Always
 
From the first beta of Swift, we have been able to see the Swift interface for a module through an interactive process. You start with a Swift file in an Xcode project, right-click on a symbol, and choose "Jump to Definition"; Xcode will generate a file with the declaration.

That procedure is a bit tedious. It's very manual; you have to start with a Swift file in an Xcode project; and you have to know the name of the symbol in advance. It doesn't generate all the declarations in the module — if the module was defined in Objective-C, it only shows declarations from a single .h file.

I learned about the command-line tool swift-ide-test in Beta 3 via http://www.jpsim.com/uncovering-sourcekit/. By using a command like the following, I could generate the declarations for an entire framework:

xcrun swift-ide-test -print-module -source-filename /dev/null \
    -sdk /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk \
    -print-regular-comments -module-print-submodules -module-to-print CoreGraphics

However, in Beta 4 the swift-ide-test command has disappeared.

I figured out a partial workaround, based on a blog post by Erica Sadun (http://ericasadun.com/2014/07/28/swift-docs-generation/).
 
The Swift REPL has a :print_module command that dumps all the declarations in the module.  Unlike choosing a module in Xcode, it doesn't stop at just one (virtual) header.
 
So this command will print out all the declarations in CoreGraphics:
echo ":print_module CoreGraphics" | xcrun swift -integrated-repl

However, Chris Lattner stated:
Note that "-integrated-repl" is obsolete, buggy, has never been documented, and is slated for removal in a later beta.  Please don't get attached to it :-)

My request:
Please document a solution for generating the Swift interface for a compiled module from a command-line tool, much like swift-ide-tool did.

Steps to Reproduce:
1. Install Xcode 6 beta
2. Type one of the above command lines to name a module for which the Swift interface is desired.

Expected Results:
stdout gets the text description of the Swift interface of the compiled module.

Actual Results:
Commands (like swift-ide-test) have been removed or are in the process of being removed.

Notes:
Discussed in forum: https://devforums.apple.com/message/1013822

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!