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

Unable to create YArray with YMap type #49

Open
georgevjr03 opened this issue Jul 22, 2024 · 3 comments
Open

Unable to create YArray with YMap type #49

georgevjr03 opened this issue Jul 22, 2024 · 3 comments

Comments

@georgevjr03
Copy link

I wanted to create a YArray with YMap type but it says Type 'YMap' does not conform to protocol 'Decodable'.How do i navigate through this error, also it enables me to only create a YMap with string data type which limits the purpose of using YMaps.I feel that in the YJS all these datatypes need not be created during definition and are dynamic.Also in an another YSwift repository i am able to easily create an YArray with YMap type without this same error.
Screenshot 2024-07-22 at 1 59 56 PM

@heckj
Copy link
Collaborator

heckj commented Jul 22, 2024

I think what you're trying to do it create an array of dictionaries, keyed by strings. This technique - one CRDT inside another - is what we've been calling nested CRDTs, and it's not (yet) supported by YSwift with the current release. The underlying Yrs and Yjs implementations support it, but the binding across languages and transfer to relevant internal types to represent the dynamic elements doesn't yet exist in the YSwift bindings.

@georgevjr03
Copy link
Author

Thanks for the response...i was wondering whether i could have a workaround such as to create a custom encodableYMap so that i can create a nested CRDT.This is basically so that i can create a YArray with YMap type for my use case.Do let me know your thoughts in this approach.I was also wondering if the yswift module will cause an error for this workaround??
Screenshot 2024-08-02 at 6 02 03 PM
Screenshot 2024-08-02 at 6 02 16 PM
Screenshot 2024-08-02 at 6 05 17 PM

@georgevjr03
Copy link
Author

Also was wondering to how i would be able to use the YXML, or probably suggest me a workaround since in the current version of yswift YXML cannot be created.

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

No branches or pull requests

2 participants