source for a Swift module's interface


(Dave Yost) #1

In Xcode I can put the caret on Darwin in "import Darwin” and use Jump to Definition to see a Swift source file for the Darwin module. But the file has no name, and clicking on the Show In Finder contextual menu item (which is enabled) does nothing but activate the Finder. I have looked every which way and haven’t found a Swift interface source file for Darwin, Swift, Foundation, anything.

If I follow the Package Manager's instructions for wrapping a C library for Swift import <https://github.com/apple/swift-package-manager/blob/master/Documentation/Usage.md#require-system-libraries> and then try to use Jump to Definition to see the built module’s interface source file, nothing happens. Again, the module’s Swift interface source code is nowhere to be found in the built files.

Is there some trick haven’t found?

How does anyone know what the interface to a wrapped library looks like?


(Jacob Bandes-Storch) #2

You can print out the interface using `:type lookup MyModule` in the REPL,
as discussed here: https://bugs.swift.org/browse/SR-2502

···

On Mon, Jan 16, 2017 at 6:18 PM, Dave Yost via swift-users < swift-users@swift.org> wrote:

In Xcode I can put the caret on Darwin in "import Darwin” and use Jump to
Definition to see a Swift source file for the Darwin module. But the file
has no name, and clicking on the Show In Finder contextual menu item (which
is enabled) does nothing but activate the Finder. I have looked every which
way and haven’t found a Swift interface source file for Darwin, Swift,
Foundation, anything.

If I follow the Package Manager's instructions for wrapping a C library
for Swift import
<https://github.com/apple/swift-package-manager/blob/master/Documentation/Usage.md#require-system-libraries> and
then try to use Jump to Definition to see the built module’s interface
source file, nothing happens. Again, the module’s Swift interface source
code is nowhere to be found in the built files.

Is there some trick haven’t found?

How does anyone know what the interface to a wrapped library looks like?

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Jens Alfke) #3

In Xcode I can put the caret on Darwin in "import Darwin” and use Jump to Definition to see a Swift source file for the Darwin module.

You can also just hold Command down and click. I use this shortcut all the time.

But the file has no name, and clicking on the Show In Finder contextual menu item (which is enabled) does nothing but activate the Finder. I have looked every which way and haven’t found a Swift interface source file for Darwin, Swift, Foundation, anything.

These aren’t files. They’re generated on the fly by Xcode, either by parsing C headers, or by decompiling binaries.

—Jens

···

On Jan 16, 2017, at 6:18 PM, Dave Yost via swift-users <swift-users@swift.org> wrote:


(Dave Yost) #4

I think they should be provided as files. At least it would be good if there were a command line tool to produce the Swift source files. No such luck?

···

On 2017-01-16, at 9:06 PM, Jens Alfke <jens@mooseyard.com> wrote:

On Jan 16, 2017, at 6:18 PM, Dave Yost via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

In Xcode I can put the caret on Darwin in "import Darwin” and use Jump to Definition to see a Swift source file for the Darwin module.

You can also just hold Command down and click. I use this shortcut all the time.

But the file has no name, and clicking on the Show In Finder contextual menu item (which is enabled) does nothing but activate the Finder. I have looked every which way and haven’t found a Swift interface source file for Darwin, Swift, Foundation, anything.

These aren’t files. They’re generated on the fly by Xcode, either by parsing C headers, or by decompiling binaries.