This module is the main repository for Binding Tools for Swift.
This is a set of tools that can consume a compiled Apple Swift library and generates wrappers that allow it to be surfaced as a .NET library.
Check out our quickstart guide to build and run the tool locally.
The packaging of BTFS is still evolving, and we expect to provide a binding project style interface to make this process easier in the future.
- Classes
- Structs
- Enums
- Protocols without associated types
- Top-level functions and variables
- Generic classes, structs, and enums
- Escaping closures
- Support of
@ObjC
types - Protocol composition types in non-virtual methods
- Exceptions
- Extensions
- Protocols with associated types
- Bound generic types with closures
- Non-escaping closures
- An
open
class in Swift can be subclassed in C# and the subclass can be passed in to Swift. Overridden virtual methods in C# will be called when invoked from Swift. - A C# type implementing an interface bound to a Swift protocol can be passed in to Swift. Methods and properties in the C# interface implementation will be called when invoked from Swift.
- At runtime, the generated code honors the Swift Automatic Reference Counting as well as .NET garbage collection.
- When writing bindings, the code generator tries hard to generate something. If an API uses a type that’s not supported yet, that API will be flagged and skipped.
The docs directory contains a detailed walkthrough of how things work under the hood.
In particular the functional outline is a great place to start exploring.
- Discuss development and design on Gitter
Copyright (c) .NET Foundation Contributors. All rights reserved. Licensed under the MIT License.