Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decide correct Swift types for user-provided data #13

Closed
4 tasks done
lawrence-forooghian opened this issue Aug 15, 2024 · 1 comment · Fixed by #205
Closed
4 tasks done

Decide correct Swift types for user-provided data #13

lawrence-forooghian opened this issue Aug 15, 2024 · 1 comment · Fixed by #205
Assignees
Labels
enhancement New feature or improved functionality.

Comments

@lawrence-forooghian
Copy link
Collaborator

lawrence-forooghian commented Aug 15, 2024

I am not sure of the best way to represent the following types from the TypeScript repo in Swift:

Given the emphasis on type safety in Swift, we want to do our best to make the type system:

  • only permit valid values
  • require as little runtime type-checking as possible for users, and guide the user as much as possible to get this type-checking right

May be worth thinking about whether Codable could be of any use.

As part of this it might also be worth:

  • revisiting how I’ve chosen to implement the Headers type in Swift.

┆Issue is synchronized with this Jira Story by Unito

@umair-ably
Copy link
Collaborator

Extending this to cover the change to Int from NSNumber in both Metadata and Headers. They both need to conform to Codable due to being using in another Codable conforming type (Message). Changing NSNumber to Int was the easiest way to resolve this right now, but unsure what ramifications (if any) there are from doing this.

@lawrence-forooghian lawrence-forooghian self-assigned this Dec 12, 2024
lawrence-forooghian added a commit that referenced this issue Dec 17, 2024
The type that I gave it in 20e7f5f was just copied from the JS SDK, but
we can do better - make it strongly typed, using a type that’s
consistent with PresenceData.

Part of #13.
lawrence-forooghian added a commit that referenced this issue Dec 18, 2024
The type that I gave it in 20e7f5f was just copied from the JS SDK, but
we can do better - make it strongly typed, using a type that’s
consistent with PresenceData.

Part of #13.
lawrence-forooghian added a commit that referenced this issue Dec 18, 2024
The spec isn’t explicit about the type (have created [1] for this to be
clarified), but from the examples given there, it seems that it can be
any JSON object.

Part of #13.

[1] ably/specification#260
lawrence-forooghian added a commit that referenced this issue Dec 18, 2024
The spec isn’t explicit about the type (have created [1] for this to be
clarified), but from the examples given there, it seems that it can be
any JSON `object`.

Part of #13.

[1] ably/specification#260
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improved functionality.
Development

Successfully merging a pull request may close this issue.

2 participants