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

Can use AnyCodable through PropertyWrapper #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Woollim
Copy link

@Woollim Woollim commented Nov 6, 2020

Hi~ First I'm happy for your great library. it makes our code more more simple and easy.

But I thinks AnyCodable has one problem.
When we use AnyCodable, we must implemented Codingkeys and Codable's many function 😱
This problem makes me write more codes. it's bad.

So I think good solution that is use PropertyWrapper.
When we use PropertyWrapper, we don't have to write many codes.
Just put it on to prefix.

This idea is inspired by KeyedCodable.CodedBy

class Example: Codable {
  @CodedAnyArray var array: [Any]
  @CodedIfPresentAnyDictionary var dict: [String: Any]?
}

Before merge this pull request, I have some problems to want to solve.

Problem

  • I don't know "CodedAnyArray", "CodedAnyDictionary", "CodedIfPresentAnyArray", "CodedIfPresentAnyDictionary" is good name.
  • "CodedIfPresentAnyArray", "CodedIfPresentAnyDictionary" isn't work in no json key. like this json "{}"

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.

1 participant