Skip to content

[AIT-124] Sketch of how user-specified types might work in Swift#129

Draft
lawrence-forooghian wants to merge 9 commits into
2025-12-09-path-based-api-proposalfrom
2025-12-12-path-based-api-experiment-user-provided-types
Draft

[AIT-124] Sketch of how user-specified types might work in Swift#129
lawrence-forooghian wants to merge 9 commits into
2025-12-09-path-based-api-proposalfrom
2025-12-12-path-based-api-experiment-user-provided-types

Conversation

@lawrence-forooghian
Copy link
Copy Markdown
Collaborator

@lawrence-forooghian lawrence-forooghian commented May 11, 2026

This builds on top of #128. Was never finished due to shifting priorities.

Some notes by Claude:

A standalone experiment to convince ourselves that, if we later wanted to, we could layer support for user-specified object shapes (the Swift analogue of ably-js's channel.object.get<MyChannelObject>()) on top of the unshaped path-based API proposed in #128, without breaking it.

Everything new lives under Sources/AblyLiveObjects/Public/UserDefinedTypeSupport/. The README.md inside is the reader's guide. If you only want to read one file, read Example/Shape.swift — it shows what the API would ideally look like to a user.

What this is / isn't

  • It isn't intended to ship as part of the initial GA — the plan is to ship the unshaped API first ([AIT-124] Proposal for how the path-based API will look in Swift #128).
  • The experiment compiles and the example call sites look the way they should.
  • It's not yet a complete proof:
    • The hand-written stand-in for codegen in Example/GeneratedCode.swift still has unfilled pieces (PathObjectKnownEntry.init?(key:pathObject:) is fatalError("TODO")).
    • No real @LiveMapShape macro has been written — the "generated" code is hand-written.

So this directory shows that the shape of the public API is expressible in Swift and that example call sites compile, but the codegen-and-runtime-glue layer underneath remains unproven.

Further notes

A couple of notes that I wrote down at the time, which explain my thinking on this (basically, I was inspired by Swift's KeyPath):

  • I think that KeyPath into the shape is a non-starter because:
    • you can't convert to a string (i.e. you can't get the path out of it)
    • it's also not really consistent with the JS API, which in general works with single keys, not paths (except for at())
  • but we can be inspired by KeyPath and have a type-specific LiveMapKey or something that has a Value telling you what you can expect to get for that key

Related tickets

  • AIT-124 — Swift Path-based LO API: understand how to implement in Swift (this experiment is part of "understand how")

lawrence-forooghian and others added 9 commits May 11, 2026 15:19
Not sure of best approach here yet
Briefly explains what the directory is for (proving we could later layer
shape support on top of the unshaped path-based API), names the files,
points readers who only want to read one file at Example/Shape.swift,
and notes that the proof is still incomplete: the example generated code
isn't fully filled in and no real codegen has been demonstrated yet.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d54d892e-ca6a-4877-beed-f2c85132ce94

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2025-12-12-path-based-api-experiment-user-provided-types

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lawrence-forooghian lawrence-forooghian changed the base branch from main to 2025-12-09-path-based-api-proposal May 11, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant