Hey everyone, I’ve hit a wall with figuring out NSCache in conjunction with Realm. Basically, I have a function for opening up the Realm and storing results from some Plant objects, and that works great. Additionally, I was able to set up another model for caching Image URLs, and I’m able to pass through a URL string from the Plant object retrieved from Realm just fine.
The problem is, I can’t seem to figure out how to cache ALL the data from the Realm Object once it’s called - right now, everything’s based on EnvironmentObject/Observable Object, so every single time the view is accessed, the Realm function shoots off and it takes a few seconds to propagate even 5 documents from Realm. I’d like to avoid that by caching objects altogether.
Would this require shifting data from the ObservableObject Realm Object into CoreData? I’d like to avoid that and stick with NSCache if possible, but would love any advice on the matter!