Plist2swift: Fix Generation of Sub-Keys in Dictionaries#104
Merged
Conversation
The tool was previously non-deterministic in code generation for different orders of property lists passed as parameters. This generated some side effects where blocks of code wouldn’t be generated at all depending on the order of property lists that were passed to the tool **and** the difference in keys between these property lists. This commit introduces a smarter behavior for property lists that contain dictionaries, and these dictionaries contain different keys, also called sub-keys in this context. Before code generation already known keys that aren’t present in the currently processed property list are merged with its contents, so that further code generation methods can determine the optionality of these keys. These keys were previously not part of the generated code.
It is possible to generate a local Xcode project for a local development environment now: `swift package generate-xcodeproj`. The project won’t be commited and you can debug with custom parameters set in the scheme’s argument. It is no longer necessary to compile the tool before usage. It can be used as a regular script.
kmeinh
approved these changes
Feb 27, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tool was previously non-deterministic in code generation for
different orders of property lists passed as parameters. This
generated some side effects where blocks of code wouldn’t be generated
at all depending on the order of property lists that were passed to
the tool and the difference in keys between these property lists.
This PR introduces a smarter behavior for property lists that
contain dictionaries, and these dictionaries contain different keys,
also called sub-keys in this context. Before code generation already
known keys that aren’t present in the currently processed property
list are merged with its contents, so that further code generation
methods can determine the optionality of these keys. These keys were
previously not part of the generated code.
It is possible to generate a local Xcode project for a local
development environment now:
swift package generate-xcodeproj. Theproject won’t be commited and you can debug with custom parameters set
in the scheme’s argument.
It is no longer necessary to compile the tool before usage. It can
be used as a regular script instead.