[swift-users] what's in the file of .swiftmodule?how to open it?

Jordan Rose jordan_rose at apple.com
Tue Jan 12 12:06:04 CST 2016

Hi, Bob. A swiftmodule file contains serialized ASTs (and possibly SIL)—it's basically a binary file format equivalent to header files for a C framework or library. There's some more information available in Serialization.rst <https://github.com/apple/swift/blob/master/docs/Serialization.rst> in the compiler docs.

You can use the swift-ide-test tool to dump the public interface for a module, but the command-line interface is less pretty than it should be:

swift-ide-test -print-module -source-filename=dummy.swift -module-to-print=MyApp

…plus any -I or -F paths necessary to find your module and all its dependencies. If you're on a Mac, you'll need to insert "xcrun -sdk macosx" or "xcrun -sdk iphoneos" at the start to find the system headers.

Hope that helps,

P.S. This is something we should make easier to do outside of Xcode. In Xcode, you can "Jump to Definition" on an import to see the same public interface.

> On Jan 11, 2016, at 17:57, qibo_cn--- via swift-users <swift-users at swift.org> wrote:
> as title.
> Best
> Bob
>  _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160112/a6d8fb90/attachment.html>

More information about the swift-users mailing list