Skip to content

maxgrig/binding-tools-for-swift

 
 

Repository files navigation

Xamarin Binding Tools For Swift

Welcome!

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.

Quickstart

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.

Current Status

What Binds?

  • 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

What Doesn’t Bind Yet?

  • Protocols with associated types
  • Bound generic types with closures
  • Non-escaping closures

What Else Can I Expect?

  • 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.

Technical Documentation

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.

Feedback

  • Discuss development and design on Gitter

Gitter

License

Copyright (c) .NET Foundation Contributors. All rights reserved. Licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 94.3%
  • Swift 2.9%
  • Shell 1.6%
  • Other 1.2%