Reputation: 694
I created a Swift 5.1 app with Xcode 11.0 which contains c-files and h-files. A bridging header was automatically generated by Xcode. I entered the necessary #imports. The project compiles and runs as expected. Now I wanted to create a Swift-package which contains the c-files and header-files, the bridging-header file and a Swift file which is a wrapper of the c-functions. I did it in the following way.
It seems to me, that including c-files into a Swift-package requires some additional steps. I searched in the documentation, but I couldn't find a hint.
Upvotes: 3
Views: 901
Reputation: 6772
Basically you cannot at this time have mixed C and Swift sources in the same package.
You can, however, have one target that includes all of your C-files, then have a different target that includes your Swift files but depends on your C-file target.
From your question it seems like you are missing a lot of intermediate steps. If I were you I would try to get a simple example working with just the C-files and then move on to adding the Swift target that depends on that.
Upvotes: 2