glideapps / quicktype

Generate types and converters from JSON, Schema, and GraphQL
https://app.quicktype.io
Apache License 2.0
11.79k stars 1.04k forks source link

Swift - CodingKeys improvements #2518

Closed brenoxp closed 3 months ago

brenoxp commented 4 months ago

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:

How to Use:

quicktype \
  --src person.json \
  --src-lang json \
  --lang swift \
  --access-level public\
  --coding-keys-protocol "CaseIterable"\
  --out Person.swift
dvdsgl commented 3 months ago

Thank you!