Skip to content

feat(swift): support enum/time serialization for swift#3371

Merged
chaokunyang merged 7 commits intoapache:mainfrom
chaokunyang:refine_fory_swift_support
Feb 19, 2026
Merged

feat(swift): support enum/time serialization for swift#3371
chaokunyang merged 7 commits intoapache:mainfrom
chaokunyang:refine_fory_swift_support

Conversation

@chaokunyang
Copy link
Copy Markdown
Collaborator

@chaokunyang chaokunyang commented Feb 19, 2026

Why?

  • Align Swift package/module naming with the rest of the project (ForySwift -> Fory) and simplify target layout.
  • Add missing built-in xlang date/time support and macro-generated enum serialization support.
  • Increase Swift test coverage for these features and for weak-reference tracking behavior.

What does this PR do?

  • Renames Swift package products/targets and source directories:
    • ForySwift -> Fory
    • ForySwiftMacros -> ForyMacro
    • ForySwiftTests -> ForyTests
    • Moves xlang peer target to Tests/ForyXlangPeer
  • Adds DateTimeSerializers.swift with:
    • ForyDate (.date)
    • ForyTimestamp (.timestamp, with second/nanos normalization)
    • Date: Serializer bridge using timestamp encoding
  • Wires date/time support into deserialization paths (TypeResolver and FieldSkipper).
  • Updates Context helper dispatch to call module-global read/write helpers instead of ForySwift.* symbols.
  • Extends @ForyObject macro to support enums:
    • no-payload enums -> ordinal enum serialization (ForyTypeId.enumType)
    • associated-value enums -> tagged-union serialization (ForyTypeId.typedUnion)
  • Simplifies ForyXlangPeer by replacing handwritten enum/date/union serializers with macro-based enums and shared ForyDate/ForyTimestamp types.
  • Adds/updates tests:
    • DateTimeTests.swift for date/timestamp type IDs and round-trip behavior
    • EnumTests.swift for enum and tagged-union round trips
    • ForySwiftTests.swift coverage for weak self-reference tracking

Related issues

#1017
#3349

Does this PR introduce any user-facing change?

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

@chaokunyang chaokunyang changed the title feat(swift): Refine fory swift support feat(swift): support enum/time serialization for swift Feb 19, 2026
@chaokunyang chaokunyang merged commit 6117f5d into apache:main Feb 19, 2026
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants