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.git
The following commit(s) were added to refs/heads/main by this push:
new 60460dda5 feat(swift): add direct Fory initializer and update Swift
docs (#3373)
60460dda5 is described below
commit 60460dda5271a3b9cc6f0834b8fc1a0379d9dca2
Author: Shawn Yang <[email protected]>
AuthorDate: Fri Feb 20 14:56:55 2026 +0800
feat(swift): add direct Fory initializer and update Swift docs (#3373)
## Why?
- Swift configuration examples were verbose (`Fory(config: .init(...))`)
and harder to read.
- Swift-facing docs needed to align with the current API ergonomics and
feature scope.
- Docs navigation was missing Swift/Xlang category metadata.
## What does this PR do?
- Add a direct initializer `Fory(xlang:trackRef:compatible:)` in
`swift/Sources/Fory/Fory.swift`.
- Keep `Fory(config:)` as a convenience initializer to preserve
config-based usage.
- Add `namedInitializerBuildsConfig` in
`swift/Tests/ForyTests/ForySwiftTests.swift` to verify defaults,
explicit args, and `Fory(config:)` parity.
- Update Swift guide snippets to use the direct initializer across
configuration, references, schema evolution, and cross-language docs.
- Rewrite `swift/README.md` with expanded quick start, core features,
cross-language guidance, and documentation links.
- Add `_category_.json` for `docs/guide/swift/` and `docs/guide/xlang/`
for sidebar organization.
## Related issues
#3349
## Does this PR introduce any user-facing change?
- [x] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?
## Benchmark
Not applicable (no wire-format change in this PR).
---
README.md | 9 +-
docs/guide/swift/_category_.json | 6 +
docs/guide/swift/configuration.md | 12 +-
docs/guide/swift/cross-language.md | 4 +-
docs/guide/swift/index.md | 18 ++
docs/guide/swift/references.md | 6 +-
docs/guide/swift/schema-evolution.md | 6 +-
docs/guide/xlang/_category_.json | 6 +
swift/README.md | 355 ++++++++++++++++++++++++-----
swift/Sources/Fory/Fory.swift | 12 +-
swift/Tests/ForyTests/ForySwiftTests.swift | 18 ++
11 files changed, 377 insertions(+), 75 deletions(-)
diff --git a/README.md b/README.md
index f94ab3d22..a7f13b2f2 100644
--- a/README.md
+++ b/README.md
@@ -67,12 +67,9 @@ All protocol families share the same optimized codebase,
allowing improvements i
## Benchmarks
-> **Note**: Different serialization frameworks excel in different scenarios.
Benchmark results are for reference only.
-> For your specific use case, conduct benchmarks with appropriate
configurations and workloads.
-
### Java Serialization Performance
-The following benchmarks compare Fory against popular Java serialization
frameworks. Charts labeled **"compatible"** show schema evolution mode with
forward/backward compatibility enabled, while others show schema consistent
mode where class schemas must match.
+Charts labeled **"compatible"** show schema evolution mode with
forward/backward compatibility enabled, while others show schema consistent
mode where class schemas must match.
**Serialization Throughput**:
@@ -86,9 +83,7 @@ The following benchmarks compare Fory against popular Java
serialization framewo
<img src="docs/benchmarks/java/java_repo_deserialization_throughput.png"
width="95%" alt="Java Deserialization Throughput">
</p>
-**Important**: Fory's runtime code generation requires proper warm-up for
performance measurement:
-
-For additional benchmarks covering type forward/backward compatibility,
off-heap support, and zero-copy serialization, see [Java
Benchmarks](docs/benchmarks/java).
+See [Java Benchmarks](docs/benchmarks/java) for more details.
### Rust Serialization Performance
diff --git a/docs/guide/swift/_category_.json b/docs/guide/swift/_category_.json
new file mode 100644
index 000000000..3a9187fed
--- /dev/null
+++ b/docs/guide/swift/_category_.json
@@ -0,0 +1,6 @@
+{
+ "label": "Swift",
+ "position": 9,
+ "collapsible": true,
+ "collapsed": true
+}
diff --git a/docs/guide/swift/configuration.md
b/docs/guide/swift/configuration.md
index 3ff8f03d3..4c037513f 100644
--- a/docs/guide/swift/configuration.md
+++ b/docs/guide/swift/configuration.md
@@ -49,7 +49,7 @@ Controls cross-language protocol mode.
- `false`: Use Swift-native mode
```swift
-let fory = Fory(config: .init(xlang: true))
+let fory = Fory(xlang: true)
```
### `trackRef`
@@ -60,7 +60,7 @@ Enables shared/circular reference tracking for
reference-trackable types.
- `true`: Preserve object identity for class/reference graphs
```swift
-let fory = Fory(config: .init(xlang: true, trackRef: true))
+let fory = Fory(xlang: true, trackRef: true)
```
### `compatible`
@@ -71,7 +71,7 @@ Enables compatible schema mode for evolution across versions.
- `true`: Compatible mode (supports add/remove/reorder fields)
```swift
-let fory = Fory(config: .init(xlang: true, trackRef: false, compatible: true))
+let fory = Fory(xlang: true, trackRef: false, compatible: true)
```
## Recommended Presets
@@ -79,17 +79,17 @@ let fory = Fory(config: .init(xlang: true, trackRef: false,
compatible: true))
### Local, strict schema
```swift
-let fory = Fory(config: .init(xlang: false, trackRef: false, compatible:
false))
+let fory = Fory(xlang: false, trackRef: false, compatible: false)
```
### Cross-language service payloads
```swift
-let fory = Fory(config: .init(xlang: true, trackRef: false, compatible: true))
+let fory = Fory(xlang: true, trackRef: false, compatible: true)
```
### Graph/object identity workloads
```swift
-let fory = Fory(config: .init(xlang: true, trackRef: true, compatible: true))
+let fory = Fory(xlang: true, trackRef: true, compatible: true)
```
diff --git a/docs/guide/swift/cross-language.md
b/docs/guide/swift/cross-language.md
index 896141f3f..f4b1781a4 100644
--- a/docs/guide/swift/cross-language.md
+++ b/docs/guide/swift/cross-language.md
@@ -24,7 +24,7 @@ Fory Swift can exchange payloads with other Fory runtimes
using the xlang protoc
## Recommended Cross-language Configuration
```swift
-let fory = Fory(config: .init(xlang: true, trackRef: false, compatible: true))
+let fory = Fory(xlang: true, trackRef: false, compatible: true)
```
## Register Types with Shared Identity
@@ -38,7 +38,7 @@ struct Order {
var amount: Double = 0
}
-let fory = Fory(config: .init(xlang: true, compatible: true))
+let fory = Fory(xlang: true, compatible: true)
fory.register(Order.self, id: 100)
```
diff --git a/docs/guide/swift/index.md b/docs/guide/swift/index.md
index a7f0373c7..6914a1772 100644
--- a/docs/guide/swift/index.md
+++ b/docs/guide/swift/index.md
@@ -30,6 +30,24 @@ Apache Fory Swift provides high-performance object graph
serialization with stro
- Built-in support for dynamic values (`Any`, `AnyObject`, `any Serializer`,
`AnyHashable`)
- Reference tracking for shared/circular graphs, including weak references on
classes
+## Install
+
+Add Fory Swift from the Apache Fory GitHub repository:
+
+```swift
+dependencies: [
+ .package(url: "https://github.com/apache/fory.git", exact: "$version")
+],
+targets: [
+ .target(
+ name: "MyApp",
+ dependencies: [
+ .product(name: "Fory", package: "fory")
+ ]
+ )
+]
+```
+
## Guide Contents
- [Configuration](configuration.md)
diff --git a/docs/guide/swift/references.md b/docs/guide/swift/references.md
index 36f97e490..726758519 100644
--- a/docs/guide/swift/references.md
+++ b/docs/guide/swift/references.md
@@ -24,7 +24,7 @@ Swift reference tracking is controlled by
`ForyConfig.trackRef`.
## Enable Reference Tracking
```swift
-let fory = Fory(config: .init(xlang: true, trackRef: true, compatible: false))
+let fory = Fory(xlang: true, trackRef: true, compatible: false)
```
When enabled, reference-trackable types preserve identity and cycles.
@@ -58,7 +58,7 @@ final class AnimalPair {
}
}
-let fory = Fory(config: .init(xlang: true, trackRef: true))
+let fory = Fory(xlang: true, trackRef: true)
fory.register(Animal.self, id: 200)
fory.register(AnimalPair.self, id: 201)
@@ -92,7 +92,7 @@ final class Node {
}
}
-let fory = Fory(config: .init(xlang: true, trackRef: true))
+let fory = Fory(xlang: true, trackRef: true)
fory.register(Node.self, id: 300)
let node = Node(value: 7)
diff --git a/docs/guide/swift/schema-evolution.md
b/docs/guide/swift/schema-evolution.md
index 958c0da4f..3ae00f086 100644
--- a/docs/guide/swift/schema-evolution.md
+++ b/docs/guide/swift/schema-evolution.md
@@ -24,7 +24,7 @@ Fory supports schema evolution through compatible mode.
## Enable Compatible Mode
```swift
-let fory = Fory(config: .init(xlang: true, trackRef: false, compatible: true))
+let fory = Fory(xlang: true, trackRef: false, compatible: true)
```
## Example: Evolving a Struct
@@ -46,10 +46,10 @@ struct PersonV2 {
var phone: String? = nil // added field
}
-let writer = Fory(config: .init(xlang: true, compatible: true))
+let writer = Fory(xlang: true, compatible: true)
writer.register(PersonV1.self, id: 1)
-let reader = Fory(config: .init(xlang: true, compatible: true))
+let reader = Fory(xlang: true, compatible: true)
reader.register(PersonV2.self, id: 1)
let v1 = PersonV1(name: "alice", age: 30, address: "main st")
diff --git a/docs/guide/xlang/_category_.json b/docs/guide/xlang/_category_.json
new file mode 100644
index 000000000..1884f53d1
--- /dev/null
+++ b/docs/guide/xlang/_category_.json
@@ -0,0 +1,6 @@
+{
+ "label": "Cross Language",
+ "position": 10,
+ "collapsible": true,
+ "collapsed": true
+}
diff --git a/swift/README.md b/swift/README.md
index 8dd9d5f42..1ee66ac63 100644
--- a/swift/README.md
+++ b/swift/README.md
@@ -2,42 +2,50 @@
[](https://github.com/apache/fory/blob/main/LICENSE)
-Apache Foryβ’ Swift is the Swift implementation of Apache Fory's
high-performance serialization framework.
+**Apache Foryβ’** is a blazing-fast multi-language serialization framework.
-It provides:
+The Swift implementation provides high-performance object graph serialization
with macro-based code generation, schema evolution support, and xlang
interoperability.
-- Macro-driven serialization for structs, classes, and enums (`@ForyObject`)
-- Cross-language interoperability via xlang protocol
-- Compatible mode for schema evolution
-- Reference tracking for shared/circular object graphs
-- Dynamic serialization for `Any`, `AnyObject`, and `any Serializer`
+## π Why Apache Foryβ’ Swift?
-## Package Layout
+- **π₯ Fast Binary Serialization**: Efficient encoding for Swift value and
reference types
+- **π§© Macro-Driven Models**: Use `@ForyObject` to generate serializers for
structs, classes, and enums
+- **π Cross-Language**: Exchange payloads with Java, Rust, Go, Python, and
other Fory runtimes via xlang
+- **π Shared/Circular References**: Preserve object identity with `trackRef`
for reference graphs
+- **𧬠Dynamic Values**: Serialize `Any`, `AnyObject`, `any Serializer`,
`AnyHashable`, and dynamic containers
+- **π¦ Schema Evolution**: Enable compatible mode for add/remove/reorder field
evolution
+- **β οΈ Clear Scope**: Swift currently focuses on object graph serialization
(row-format APIs are not exposed yet)
-- `Fory`: core Swift runtime and macro declarations
-- `ForyMacro`: macro implementation target used by `@ForyObject` and
`@ForyField`
-- `ForyXlangTests`: executable used by Java xlang integration tests
-- `ForyTests`: Swift unit tests
+## π¦ Package Layout
-## Quick Start
+| Target | Description
|
+| ---------------- |
----------------------------------------------------------- |
+| `Fory` | Core Swift runtime and macro declarations
|
+| `ForyMacro` | Macro implementation used by `@ForyObject` and
`@ForyField` |
+| `ForyXlangTests` | Executable used by Java-driven xlang integration tests
|
+| `ForyTests` | Swift unit tests
|
-### Add dependency (local development)
+## π Quick Start
+
+### 1. Add dependency
`Package.swift`:
```swift
dependencies: [
- .package(path: "../fory/swift")
+ .package(url: "https://github.com/apache/fory.git", branch: "main")
],
targets: [
.target(
name: "MyApp",
- dependencies: ["Fory"]
+ dependencies: [
+ .product(name: "Fory", package: "fory")
+ ]
)
]
```
-### Serialize and deserialize
+### 2. Basic serialization
```swift
import Fory
@@ -58,7 +66,7 @@ let output: User = try fory.deserialize(data)
assert(input == output)
```
-### Buffer-oriented APIs
+### 3. Buffer-oriented APIs
```swift
var out = Data()
@@ -69,53 +77,115 @@ let output2: User = try fory.deserialize(from: buffer)
assert(output2 == input)
```
-## Configuration
+## π Core Features
+
+### 1. Object Graph Serialization
+
+Use `@ForyObject`, register user types, then serialize/deserialize.
```swift
-let fory = Fory(config: .init(
- xlang: true,
- trackRef: false,
- compatible: true
-))
-```
+import Fory
-- `xlang`: enable cross-language wire compatibility
-- `trackRef`: preserve shared/circular reference identity
-- `compatible`: enable schema evolution mode
+@ForyObject
+struct Address: Equatable {
+ var street: String = ""
+ var zip: Int32 = 0
+}
-## Type Registration
+@ForyObject
+struct Person: Equatable {
+ var id: Int64 = 0
+ var name: String = ""
+ var nickname: String? = nil
+ var tags: Set<String> = []
+ var scores: [Int32] = []
+ var addresses: [Address] = []
+ var metadata: [Int8: Int32?] = [:]
+}
+
+let fory = Fory()
+fory.register(Address.self, id: 100)
+fory.register(Person.self, id: 101)
+
+let person = Person(
+ id: 42,
+ name: "Alice",
+ nickname: nil,
+ tags: ["swift", "xlang"],
+ scores: [10, 20, 30],
+ addresses: [Address(street: "Main", zip: 94107)],
+ metadata: [1: 100, 2: nil]
+)
+
+let bytes = try fory.serialize(person)
+let decoded: Person = try fory.deserialize(bytes)
+assert(decoded == person)
+```
-Register user types before use.
+### 2. Shared and Circular References
+
+Enable reference tracking for class/reference graphs:
```swift
-fory.register(User.self, id: 1)
-try fory.register(User.self, namespace: "com.example", name: "User")
-try fory.register(User.self, name: "com.example.User")
+let fory = Fory(xlang: true, trackRef: true, compatible: false)
```
-## Field Encoding Overrides
-
-Use `@ForyField` for integer encoding control.
+Shared reference identity is preserved:
```swift
+import Fory
+
@ForyObject
-struct Metrics {
- @ForyField(encoding: .fixed)
- var u32Fixed: UInt32 = 0
+final class Animal {
+ var name: String = ""
- @ForyField(encoding: .tagged)
- var u64Tagged: UInt64 = 0
+ required init() {}
+
+ init(name: String) {
+ self.name = name
+ }
}
+
+@ForyObject
+final class AnimalPair {
+ var first: Animal? = nil
+ var second: Animal? = nil
+
+ required init() {}
+
+ init(first: Animal? = nil, second: Animal? = nil) {
+ self.first = first
+ self.second = second
+ }
+}
+
+let fory = Fory(xlang: true, trackRef: true)
+fory.register(Animal.self, id: 200)
+fory.register(AnimalPair.self, id: 201)
+
+let shared = Animal(name: "cat")
+let input = AnimalPair(first: shared, second: shared)
+
+let data = try fory.serialize(input)
+let decoded: AnimalPair = try fory.deserialize(data)
+assert(decoded.first === decoded.second)
```
-Supported type/encoding combinations:
+For cyclic graphs, use `weak` on at least one edge to avoid ARC leaks:
-- `Int32`, `UInt32`: `.varint`, `.fixed`
-- `Int64`, `UInt64`, `Int`, `UInt`: `.varint`, `.fixed`, `.tagged`
+```swift
+@ForyObject
+final class Node {
+ var value: Int32 = 0
+ weak var next: Node? = nil
-## Dynamic and Polymorphic Values
+ required init() {}
+}
+```
-Top-level and field-level support exists for:
+### 3. Dynamic and Polymorphic Values
+
+Top-level and field-level dynamic serialization is supported for:
- `Any`
- `AnyObject`
@@ -126,9 +196,178 @@ Top-level and field-level support exists for:
- `[Int32: Any]`
- `[AnyHashable: Any]`
-Register concrete user types used inside dynamic payloads.
+If dynamic payloads contain user-defined concrete types, register those types
before serialization/deserialization.
+
+```swift
+import Fory
-## Development
+@ForyObject
+struct DynamicAddress {
+ var street: String = ""
+ var zip: Int32 = 0
+}
+
+let fory = Fory()
+fory.register(DynamicAddress.self, id: 410)
+
+let payload: [String: Any] = [
+ "id": Int32(7),
+ "name": "alice",
+ "addr": DynamicAddress(street: "main", zip: 94107),
+]
+
+let data = try fory.serialize(payload)
+let decoded: [String: Any] = try fory.deserialize(data)
+assert(decoded["id"] as? Int32 == 7)
+```
+
+Null decoding semantics:
+
+- `Any` null is represented as `ForyAnyNullValue`
+- `AnyObject` null is represented as `NSNull`
+
+### 4. Schema Evolution (Compatible Mode)
+
+Use compatible mode to evolve schemas between peers.
+
+```swift
+import Fory
+
+@ForyObject
+struct PersonV1 {
+ var name: String = ""
+ var age: Int32 = 0
+ var address: String = ""
+}
+
+@ForyObject
+struct PersonV2 {
+ var name: String = ""
+ var age: Int32 = 0
+ var phone: String? = nil
+}
+
+let writer = Fory(xlang: true, compatible: true)
+writer.register(PersonV1.self, id: 1)
+
+let reader = Fory(xlang: true, compatible: true)
+reader.register(PersonV2.self, id: 1)
+
+let v1 = PersonV1(name: "alice", age: 30, address: "main st")
+let bytes = try writer.serialize(v1)
+let v2: PersonV2 = try reader.deserialize(bytes)
+
+assert(v2.name == "alice")
+assert(v2.age == 30)
+assert(v2.phone == nil)
+```
+
+Compatible mode supports:
+
+- Add fields
+- Remove fields
+- Reorder fields
+
+Not supported:
+
+- Arbitrary field type changes (for example `Int32` to `String`)
+
+### 5. Field Encoding Overrides
+
+Use `@ForyField(encoding:)` to control integer wire encoding.
+
+```swift
+import Fory
+
+@ForyObject
+struct Metrics {
+ @ForyField(encoding: .fixed)
+ var u32Fixed: UInt32 = 0
+
+ @ForyField(encoding: .tagged)
+ var u64Tagged: UInt64 = 0
+}
+```
+
+Supported combinations:
+
+| Swift type | Supported encodings |
+| -------------------------------- | ------------------------------ |
+| `Int32`, `UInt32` | `.varint`, `.fixed` |
+| `Int64`, `UInt64`, `Int`, `UInt` | `.varint`, `.fixed`, `.tagged` |
+
+### 6. Enum and Tagged Union Support
+
+`@ForyObject` supports C-style enums and associated-value enums.
+
+```swift
+import Fory
+
+@ForyObject
+enum Color: Equatable {
+ case red
+ case green
+ case blue
+}
+
+@ForyObject
+enum StringOrLong: Equatable {
+ case text(String)
+ case number(Int64)
+}
+
+let fory = Fory(xlang: true, compatible: false)
+fory.register(Color.self, id: 300)
+fory.register(StringOrLong.self, id: 301)
+
+let a = try fory.serialize(Color.green)
+let b = try fory.serialize(StringOrLong.text("hello"))
+
+let color: Color = try fory.deserialize(a)
+let value: StringOrLong = try fory.deserialize(b)
+
+assert(color == .green)
+assert(value == .text("hello"))
+```
+
+### 7. Custom Serializers
+
+For types that should not use `@ForyObject`, implement `Serializer` manually
and register the type.
+See `../docs/guide/swift/custom-serializers.md` for a complete example.
+
+## π Cross-Language Serialization
+
+Recommended xlang preset:
+
+```swift
+let fory = Fory(xlang: true, trackRef: false, compatible: true)
+```
+
+Type registration can be ID-based or name-based:
+
+```swift
+fory.register(MyType.self, id: 100)
+try fory.register(MyType.self, namespace: "com.example", name: "MyType")
+```
+
+Cross-language rules:
+
+- Keep registration mappings consistent across peers
+- Use compatible mode for independently evolving schemas
+- Register all user-defined concrete types used inside dynamic payloads
+
+## β οΈ Row Format Status
+
+Swift runtime currently exposes object graph serialization APIs
(`Fory.serialize` / `Fory.deserialize`).
+Row-format APIs are not exposed yet in Swift.
+
+## β‘ Performance Notes
+
+- Prefer `trackRef=false` for value-only payloads to avoid reference-table
overhead
+- Reuse the same `Fory` instance and register types once per process/service
lifecycle
+- Use schema-consistent mode (`compatible=false`) when strict schema parity is
guaranteed
+
+## π οΈ Development
Run Swift tests:
@@ -144,8 +383,20 @@ cd java/fory-core
ENABLE_FORY_DEBUG_OUTPUT=1 FORY_SWIFT_JAVA_CI=1 mvn -T16 test
-Dtest=org.apache.fory.xlang.SwiftXlangTest
```
-## Documentation
+## π Documentation
+
+- [Swift Guide](../docs/guide/swift/index.md)
+- [Configuration](../docs/guide/swift/configuration.md)
+- [Type Registration](../docs/guide/swift/type-registration.md)
+- [Schema Evolution](../docs/guide/swift/schema-evolution.md)
+- [Cross-Language Guide](../docs/guide/swift/cross-language.md)
+- [Xlang Specification](../docs/specification/xlang_serialization_spec.md)
+- [Xlang Type Mapping](../docs/specification/xlang_type_mapping.md)
+
+## π License
+
+Licensed under the Apache License, Version 2.0. See
[LICENSE](https://github.com/apache/fory/blob/main/LICENSE).
+
+## π€ Contributing
-- Swift guide: `../docs/guide/swift`
-- Xlang specification: `../docs/specification/xlang_serialization_spec.md`
-- Type mapping: `../docs/specification/xlang_type_mapping.md`
+Contributions are welcome. See
[CONTRIBUTING.md](https://github.com/apache/fory/blob/main/CONTRIBUTING.md).
diff --git a/swift/Sources/Fory/Fory.swift b/swift/Sources/Fory/Fory.swift
index aba07cc25..45a7f1705 100644
--- a/swift/Sources/Fory/Fory.swift
+++ b/swift/Sources/Fory/Fory.swift
@@ -33,11 +33,19 @@ public final class Fory {
public let config: ForyConfig
public let typeResolver: TypeResolver
- public init(config: ForyConfig = ForyConfig()) {
- self.config = config
+ public init(
+ xlang: Bool = true,
+ trackRef: Bool = false,
+ compatible: Bool = false
+ ) {
+ self.config = ForyConfig(xlang: xlang, trackRef: trackRef, compatible:
compatible)
self.typeResolver = TypeResolver()
}
+ public convenience init(config: ForyConfig) {
+ self.init(xlang: config.xlang, trackRef: config.trackRef, compatible:
config.compatible)
+ }
+
public func register<T: Serializer>(_ type: T.Type, id: UInt32) {
typeResolver.register(type, id: id)
}
diff --git a/swift/Tests/ForyTests/ForySwiftTests.swift
b/swift/Tests/ForyTests/ForySwiftTests.swift
index 065f23b55..6430ba148 100644
--- a/swift/Tests/ForyTests/ForySwiftTests.swift
+++ b/swift/Tests/ForyTests/ForySwiftTests.swift
@@ -144,6 +144,24 @@ func primitiveRoundTrip() throws {
#expect(binaryValue == binary)
}
+@Test
+func namedInitializerBuildsConfig() {
+ let defaultConfig = Fory()
+ #expect(defaultConfig.config.xlang == true)
+ #expect(defaultConfig.config.trackRef == false)
+ #expect(defaultConfig.config.compatible == false)
+
+ let explicitConfig = Fory(xlang: false, trackRef: true, compatible: true)
+ #expect(explicitConfig.config.xlang == false)
+ #expect(explicitConfig.config.trackRef == true)
+ #expect(explicitConfig.config.compatible == true)
+
+ let configInit = Fory(config: .init(xlang: false, trackRef: false,
compatible: true))
+ #expect(configInit.config.xlang == false)
+ #expect(configInit.config.trackRef == false)
+ #expect(configInit.config.compatible == true)
+}
+
@Test
func optionalRoundTrip() throws {
let fory = Fory()
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]