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

Swift - CodingKeys improvements #2518

Merged
merged 2 commits into from
Apr 13, 2024

Conversation

brenoxp
Copy link
Contributor

@brenoxp brenoxp commented Feb 20, 2024

This PR enhances the Swift code generator within the quicktype-core package by incorporating user-defined access level settings into the CodingKeys enum, alongside its ability to conform to additional protocols. This dual enhancement not only broadens the scope of customization for generated Swift code but also ensures consistency in access control and protocol conformance, facilitating more refined and secure code generation strategies.

Key Updates:

  • A new feature is introduced allowing the CodingKeys enum to inherit the access level specified by the user, ensuring that the enum's visibility aligns with the rest of the generated code.
  • The capability to specify additional protocols for the CodingKeys enum has been expanded to include the applied access level, offering a more integrated approach to custom protocol conformance.

How to Use:

quicktype \
  --src person.json \
  --src-lang json \
  --lang swift \
  --access-level public\
  --coding-keys-protocol "CaseIterable"\
  --out Person.swift

@dvdsgl dvdsgl enabled auto-merge (squash) April 13, 2024 21:53
@dvdsgl
Copy link
Member

dvdsgl commented Apr 13, 2024

Thank you!

@dvdsgl dvdsgl merged commit 19c0b3f into glideapps:master Apr 13, 2024
24 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.

None yet

2 participants