The goal of this project is to provide idiomatic bindings to Windows APIs for the Swift programming language.
To be able to call Windows APIs from Swift, we need to speak their ABI (Application Binary Interface) which defines how compiled programs can talk to each other. There are 3 main ABIs used on Windows:
-
The C programming language ABI, used by the low-level Win32 API
-
COM (Component Object Model), which adds object-oriented constructs on top of the C ABI
-
WinRT (Windows Runtime), which is based on COM but adds additional metadata to enable automatic generation of safe, idiomatic bindings
We will be starting with modern Windows APIs based on WinRT, such as WinUI 3.
WinRT APIs are described in WinMD (Windows Metadata) files, which are encoded in a binary format called CLI metadata. We will parse these files according to the format specification and use the metadata to generate Swift definitions for the APIs they describe.
This generated Swift code will be distributed as a library that anyone can use to develop Windows apps using Swift.
-
Swift Binary Parsing Documentation (this is the library we are using to parse CLI metadata)