From a962f267527f73e2d67781d95210e815b6f4d72d Mon Sep 17 00:00:00 2001 From: "uniffi-docs[bot]" Date: Mon, 16 Sep 2024 14:57:05 +0000 Subject: [PATCH] Deployed 8aec9dfff to next with MkDocs 1.6.0 and mike 2.1.1 --- next/swift/configuration.html | 4 +- next/swift/overview.html | 138 +++++++++++++++++++++++++++++++--- 2 files changed, 128 insertions(+), 14 deletions(-) diff --git a/next/swift/configuration.html b/next/swift/configuration.html index 2ac7eb4d48..d2d8e560ef 100644 --- a/next/swift/configuration.html +++ b/next/swift/configuration.html @@ -1452,7 +1452,7 @@

Available options

cdylib_name uniffi_{namespace}[^1] -The name of the compiled Rust library containing the FFI implementation (not needed when using generate --library). +The name of the compiled Rust library containing the FFI implementation (not needed when using --library). module_name @@ -1472,7 +1472,7 @@

Available options

generate_module_map true -Whether to generate a .modulemap file for the lower-level C module with FFI declarations. +Whether to generate a .modulemap file for the lower-level C module with FFI declarations. Not valid when using --library, in library-mode the modulemap is always generated. omit_argument_labels diff --git a/next/swift/overview.html b/next/swift/overview.html index 02688fbcd9..832b9b7607 100644 --- a/next/swift/overview.html +++ b/next/swift/overview.html @@ -1064,6 +1064,17 @@ + + @@ -1074,6 +1085,58 @@ + + + + @@ -1345,6 +1408,47 @@ + + + @@ -1389,20 +1493,30 @@

Swift Bindings

-

Conceptually, the generated bindings are split into two Swift modules, one for the low-level -C FFI layer and one for the higher-level Swift bindings. For a UniFFI component named "example" -we generate:

+

Generated files

+

UniFFI generates several kinds of files for Swift bindings:

+ +

The file layout depends on which mode is used to generate the bindings:

+

Library mode

+

uniffi-bindgen in library mode generates:

+ +

The expectation is that each .swift file will be compiled together into a single Swift module that represents the library as a whole.

+

Single UDL file

+

uniffi-bindgen in Single UDL file mode generates:

-

Splitting up the bindings in this way gives you flexibility over how both the Rust code -and the Swift code are distributed to consumers. For example, you may choose to compile -and distribute the Rust code for several UniFFI components as a single shared library -in order to reduce the compiled code size, while distributing their Swift wrappers as -individual modules.

+

The expectation is that the .swift will be compiled into a module and this is the only module to generate for the Rust library.

For more technical details on how the bindings work internally, please see the module documentation