This is an automated email from the ASF dual-hosted git repository. chaokunyang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/fory-site.git
commit 4702155127eed1b9f250752ea86731e7bc72d9f9 Author: chaokunyang <[email protected]> AuthorDate: Tue Apr 28 10:48:34 2026 +0000 🔄 synced local 'docs/compiler/' with remote 'docs/compiler/' --- docs/compiler/compiler-guide.md | 4 ++-- docs/compiler/generated-code.md | 18 ++++++++++++------ docs/compiler/index.md | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/compiler/compiler-guide.md b/docs/compiler/compiler-guide.md index 70fe2e5b6..28ed04f1f 100644 --- a/docs/compiler/compiler-guide.md +++ b/docs/compiler/compiler-guide.md @@ -248,7 +248,7 @@ Compiling src/main.fdl... | C++ | `cpp` | `.h` | Structs with FORY macros | | C# | `csharp` | `.cs` | Classes with Fory attributes | | JavaScript | `javascript` | `.ts` | Interfaces with registration function | -| Swift | `swift` | `.swift` | `@ForyObject` Swift models | +| Swift | `swift` | `.swift` | Fory Swift model macros | | Dart | `dart` | `.dart` | `@ForyStruct` classes with annotations | ## Output Structure @@ -359,7 +359,7 @@ generated/ - Single `.swift` file per schema - Package segments are mapped to nested Swift enums (for example `addressbook.*` -> `Addressbook.*`) -- Generated messages/unions/enums use `@ForyObject` and `@ForyField(id: ...)` +- Generated messages use `@ForyStruct`, enums use `@ForyEnum`, and unions use `@ForyUnion`/`@ForyCase` - Union types are generated as tagged enums with associated payload values - Each schema includes `ForyRegistration` and `toBytes`/`fromBytes` helpers - Imported schemas are registered transitively by generated registration helpers diff --git a/docs/compiler/generated-code.md b/docs/compiler/generated-code.md index 6dd2ff6df..232dfb89b 100644 --- a/docs/compiler/generated-code.md +++ b/docs/compiler/generated-code.md @@ -798,7 +798,7 @@ Swift output is one `.swift` file per schema, for example: ### Type Generation -The generator creates Swift models with `@ForyObject` and field IDs. +The generator creates Swift models with split model macros and stable field/case IDs. When package/namespace is non-empty, namespace shaping is controlled by `swift_namespace_style`: @@ -811,15 +811,15 @@ For non-empty package with default `enum` style: ```swift public enum Addressbook { - @ForyObject + @ForyUnion public enum Animal: Equatable { - @ForyField(id: 1) + @ForyCase(id: 1) case dog(Addressbook.Dog) - @ForyField(id: 2) + @ForyCase(id: 2) case cat(Addressbook.Cat) } - @ForyObject + @ForyStruct public struct Person: Equatable { @ForyField(id: 1) public var name: String = "" @@ -832,7 +832,7 @@ public enum Addressbook { For non-empty package with `flatten` style: ```swift -@ForyObject +@ForyStruct public struct Addressbook_Person: Equatable { ... } ``` @@ -840,6 +840,12 @@ The CLI flag `--swift_namespace_style` overrides schema option `swift_namespace_ Unions are generated as tagged Swift enums with associated payload values. Messages with `ref`/`weak_ref` fields are generated as `final class` models to preserve reference semantics. +Fixed or tagged integer encodings inside list/map fields are emitted as Swift +field type hints, for example `@ListField(element: .encoding(.fixed))` or +`@MapField(value: .encoding(.tagged))`. +For non-null fixed-width integer list elements, Swift classifies the field as +the corresponding Fory primitive packed-array type; fixed-width integer sets +remain Fory sets. ### Registration diff --git a/docs/compiler/index.md b/docs/compiler/index.md index f79f322dd..7790961ec 100644 --- a/docs/compiler/index.md +++ b/docs/compiler/index.md @@ -102,7 +102,7 @@ Generated code uses native language constructs: - C++: Structs with `FORY_STRUCT` macros - C#: Classes with `[ForyObject]` and registration helpers - JavaScript: Interfaces with registration function -- Swift: `@ForyObject` models with `@ForyField` metadata and registration helpers +- Swift: Fory model macros with field/case metadata and registration helpers - Dart: `@ForyStruct` classes with `@ForyField` annotations and registration helpers ## Quick Start --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
