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

Come up with a way to provide default keys for a map based on the type of the key where multiple keys required #77

Open
knovichikhin opened this issue Nov 4, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@knovichikhin
Copy link
Contributor

knovichikhin commented Nov 4, 2023

Come up with a way to provide default keys for a map based on the type of the key where multiple keys required.

Most resent attempt:

#76

if requiredSize == 1 {
let defaultKeyValue = getDefaultValue(type: keyType, fileBuilder: fileBuilder)
mapConstructor.append("\(defaultKeyValue): \(defaultValue)")
} else {
for index in 0..<requiredSize {
mapConstructor.append("\"Entry_\(index)\": \(defaultValue)")
}
}

The branch handling requiredSize > 1 can be improved by handling enum cases and values other than strings.

@knovichikhin knovichikhin added the enhancement New feature or request label Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant