Skip to content

Plist2swift: Fix Generation of Sub-Keys in Dictionaries#104

Merged
Tomusm merged 2 commits intomasterfrom
bugfix/optionals-generation-for-dictionary-subkeys
Feb 27, 2020
Merged

Plist2swift: Fix Generation of Sub-Keys in Dictionaries#104
Tomusm merged 2 commits intomasterfrom
bugfix/optionals-generation-for-dictionary-subkeys

Conversation

@rbugajewski
Copy link
Copy Markdown
Contributor

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. 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 instead.

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.
@rbugajewski rbugajewski requested a review from Tomusm February 26, 2020 23:41
@Tomusm Tomusm requested a review from kmeinh February 27, 2020 09:26
@Tomusm Tomusm merged commit 3c0778f into master Feb 27, 2020
@Tomusm Tomusm deleted the bugfix/optionals-generation-for-dictionary-subkeys branch February 27, 2020 12:02
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.

3 participants