4 Generating Swift Interface Files
Travis Prescott редактировал(а) эту страницу 2021-08-19 14:39:43 -07:00

NOTE

We now have APIView support for Swift. You should no longer generate *.swiftinterface files for API reviews.


It can be helpful to see the Swift interface without all of the comments and implementation. To do that:

  • Ensure the BUILD_LIBRARY_FOR_DISTRIBUTION setting in the Xcode project file is set to YES.
  • Build the product in XCode. Expand the Products folder and select the generated framework. In the File Inspector tab of the right-most collapsible pane of Xcode, there will be a link to the full path. Click the right arrow icon to open the Finder to the built framework's location. Inside this folder, go to Modules and then the folder that ends with .swiftmodule. Here you will find the file you need, which will look like x86_64.swiftinterface.

ALTERNATE

You must have a modulemap file alongside your mixed source files. From the folder containing your modulemap file (here called Contoso):

echo -e "import Contoso\n:type lookup Contoso" | swift -I./Contoso | tail -n+3 >| generated-interface.swiftinterface

This should generate a swiftinterface file which can be targeted by Swift APIView.