-
Hi, I'm new to Swift and TCA and I had planned to use structs as models as I've seen in the examples provided. I'm attempting to preview some of the features and have modeled relationships either with the entire model type or the model type's id value. However, I'm getting a Circular Reference error attempting to model the relationship with mocks for Previews. For example, I have the concept of an
I'd love some advice on how to model data using TCA and any advice on how to resolve the Circular Reference issue. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi @evankline, I don't think this has anything to do with TCA. You do have a circular reference in your code. If this is just mock data then you can just hard code the IDs however you want, or also I believe if you used |
Beta Was this translation helpful? Give feedback.
Hi @evankline, I don't think this has anything to do with TCA. You do have a circular reference in your code.
User.mockOne
is usingAccount.mockOne
, but alsoAccount.mockOne
is usingUser.mockOne
. That's can't possibly resolve, and so Swift just won't compile it.If this is just mock data then you can just hard code the IDs however you want, or also I believe if you used
UUID.userOneId
inAccount.mockOne
instead of calling out toUser.mockOne.id
then it would also compile.