Plain Swift

End user license agreement | How to uninstall | Release notes


Importing a Swift library into your project


If the Swift library you want to import into your Plain Swift project was written by you, then the recommended way is to start a Plain Swift project of type Swift Module and transfer your library's source code to this project. Then you just build this Swift Module project and install the resulting module into Plain Swift (Plain Swift will prompt you to install the module in the build process). Once the module is installed, you can import it into any Plain Swift project source files:

import MyModule
If the Swift library you want to import into your Plain Swift project is a third-party one, you can try to build it as is, separately from Plain Swift, and then install it into Plain Swift. Below are the steps to do this:

Build the library


Build the library following the developer's recommendations, or get a ready-made library. The library must be built using the same version of Microsoft Visual Studio that is used in your Swift toolkit. It's probably enough to match only the major versions.

Make sure that it is compiled as a dynamic library with .swiftmodule, .swiftdoc, .lib and .dll files. If some of these files are missing, you can try to modify the project, e.g. add type: .dynamic in .library section of the Package.swift file (if a .dll file is missing); Or add the -emit-module command line parameter for swiftc compiler (if a .swiftmodule file is missing).

Install the third-party module


Select the Modules | Install/Remove Swift Modules... menu command. Click the Install 3rd party... button and select the third-party project folder. If the third-party module is successfully installed, you can import it into any Plain Swift project source files:
import SomeModule