wvteijlingen / Spine

A Swift library for working with JSON:API APIs. It supports mapping to custom model classes, fetching, advanced querying, linking and persisting.
MIT License
266 stars 109 forks source link

ResourceFactory global resource pool #102

Closed markst closed 7 years ago

markst commented 8 years ago

I suppose this is related to #17 I'm trying to use a global resource pool so that objects are reused throughout the entire lifetime of Spine.

I wonder if you have any advice as to implementing this?

wvteijlingen commented 7 years ago

Not particularly. I've been out of this project for some time so I don't know the exact scope of implementing this from the top of my head.

The hardest thing I think is keeping the relationships up to date. For example, you have a resource "Foo:1" in the pool that points to resource "Bar:2". Now if you later fetch "Bar:2", you'd have to update the relationship in "Foo:1".

wvteijlingen commented 7 years ago

I'm closing this beacause it's not a direct issue with Spine.