y-crdt/yswift

Unable to create YArray with YMap type

georgevjr03 opened this issue · 3 comments

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

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.

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

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.