swiftgen
0.2.0, released 2 months ago by labs.dart.dev
A tool for generating bindings that allow interop between Dart and Swift code.
What it does
Swiftgen is an experimental tool designed to generate bindings that facilitate interop between Dart and Swift code. It relies on dependencies like ffi, ffigen, and swift2objc to achieve this integration.
AI-written summary of version 0.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to interoperate between Dart and Swift code
- You are experimenting with Swift and Dart bindings generation
Skip it when
- You need a stable, production-ready interop solution
- You are not using Swift or Dart FFI
Strengths
- Automates generating bindings between Dart and Swift
- Integrates with ffigen and swift2objc
Weaknesses
- Experimental tool
- Not documented thoroughly beyond basic description
Setup
- Kind
- FFI (native library)
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 7
not documented
Alternatives
Packages that do the same job and could replace swiftgen.
- pigeon
Type-safe code generator for communication between Flutter and host platforms.
90Compare - code_builder
A fluent, builder-based library for generating valid Dart code programmatically.
93Compare - jnigen
A Dart bindings generator for Java and Kotlin APIs using JNI and dart:ffi.
87Compare - code_assets
Provides the hook protocol specification for bundling native code with Dart packages.
88Compare
Works with
Packages commonly used together with swiftgen: ones it builds on, ones built on it, and its own family.
- package_configswiftgen depends on itRead and write Dart package configuration files.
- ffiswiftgen depends on itUtilities for working with Foreign Function Interface (FFI) code in Dart.
- loggingswiftgen depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- objective_cswiftgen depends on itSupport library for accessing Objective C via ffigen in Flutter
- ffigenswiftgen depends on itGenerator for FFI bindings, using LibClang to parse C, Objective-C, and Swift files.