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

Feature Request: Make Entity conforming to Codable or offer a #144

Closed
karstengresch opened this issue Jul 28, 2018 · 8 comments
Closed

Feature Request: Make Entity conforming to Codable or offer a #144

karstengresch opened this issue Jul 28, 2018 · 8 comments

Comments

@karstengresch
Copy link

Hi all, especially Daniel :)

I'm in a need including Entity vars in a struct that conforms to Codable (as of Swift 4).

Not sure if that makes sense in regards to the Graph API philosophy, but to me, that'd be useful as I wouldn't need to remodel the Entity's structure.

Thanks for Graph anyway - what a decent piece of great software!

Best wishes,

Karsten

@daniel-jonathan
Copy link
Member

Hey @karstengresch :)

Happy that you are enjoying Graph. Are you talking about the Swift 4.2 dynamic properties so you don't have to access the API using subscripting? If so, the second I heard about this update... I was like "finally".

@OrkhanAlikhanov
Copy link
Contributor

OrkhanAlikhanov commented Jul 30, 2018

@DanielDahan I think he wants us to make Entity type conform to Codable. This great idea because swift structs with Codable get implicit conformance by the compiler without any need for explicitly conformance to Codable by the developer if and only if all struct members conform to Codable.

@karstengresch
Copy link
Author

@DanielDahan @OrkhanAlikhanov Thanks for your replies - @OrkhanAlikhanov is right: I just think of conformance to Codable.

This would e.g. allow putting an Entity object into a Codable conformant struct (part of a larger data model) that gets locally persisted as a replacement for UserDefaults.

Not sure if this makes sense for you @DanielDahan ?

Best wishes,

Karsten

@daniel-jonathan
Copy link
Member

@karstengresch Yes it does. I think this should be doable. Let's leave this request up for now and tackle it within the next week, @OrkhanAlikhanov. Thank you!

@OrkhanAlikhanov
Copy link
Contributor

@karstengresch in what cases would you use Entity as Codable? Can you elaborate more on your above example?

@daniel-jonathan
Copy link
Member

daniel-jonathan commented Aug 15, 2018

Base solution is here #152 (review), although, we have more we would like to add feature wise. We will make a new issue to articulate the new issues.

@karstengresch
Copy link
Author

karstengresch commented Aug 17, 2018

@OrkhanAlikhanov, @DanielDahan - thanks for making this happen! You guys really rock.

@OrkhanAlikhanov regarding your question: I started using Codable instead of UserDefaults and want to integrate an entire Graph as part of a struct which then is persisted via Codable and synchronized via CloudKit.

Of course I'm aware there's GraphJSON w/ serialization and Graph w/ built-in CloudKit support, but in my case the entire struct with it's different nested elements would hardly be manageable for me w/ Graph. Makes sense?

Anyway - @OrkhanAlikhanov thank you so much for your pull request and @DanielDahan to let it get into the code base!

@daniel-jonathan
Copy link
Member

@karstengresch Keep the great requests/questions coming and we will work to improve our products :) Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants