[swift-users] How do I use Xcode for a C library wrapped in Swift

Dave Yost Dave at Yost.com
Thu Dec 22 14:43:53 CST 2016

I just posted this on StackOverflow <http://stackoverflow.com/questions/41290913/how-do-i-use-xcode-for-a-c-library-wrapped-in-swift>. Insights most welcome.

I'm trying to create an Xcode workspace that contains projects that make:

A bird dynamic library built from C source
A Cbird Swift module that wraps bird in raw Swift
A Bird Swift module that imports Cbird and wraps it in swifty Swift
A birdchirp Swift Command Line Tool that imports Bird
All of these must have an OS X Unit Testing Bundle.

I've tried various ways with various versions of Swift 3.x and snapshots to do this starting from Project.swift files and using swift package generate-xcodeproj. All of these attempts have resulted in Xcode setups that have various problems:

having to do a swift build first and then rooting an Xcode project in a directory deep within the .build directory (created by swift build) or within the (apparently now defunct) Packages directory
having to refer to other projects via github addresses
trouble with unit test bundles not finding Cbird
Selecting Cbird in an import Cbird source line and doing Jump to Definition fails to show the Swift source for Cbird.
The birdchirp project cheats and refers to Bird source files directly instead of depending on the Bird framework.
Extra credit:

Package.swift files that work with relative references to the other projects, while still allowing the projects to be mirrors of GitHub projects

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

More information about the swift-users mailing list