1

So I relatively new to app development and I'm looking for some answers to what the industry practices are. Overall my app is working, one of the problems I'm dealing with right now is the following:

Long story short: First, my app executes a network request and parses the response (=array of objects) to create an array of objects. Once that finished, the second network request will be executed and the response will be parsed to create an array of objects once again. I mapped both struct of the json responses in my app. Then, all objects in the second array have to be added to objects in the first array if one of their variables is equal. All of that works, however, the process of doing that takes approximately 5 seconds. To make the user experience better, I'm trying to cache the response to load it faster. What is the best way/industry practice of doing so?

Both responses have 770, respectively 3000 objects, consisting of string and integer variables. Is it best to save the response to a plist, core data or to use almofire and swiftyJSON according to that post?

Thomas
  • 75
  • 8
  • That's a tiny amount of data, you don't really need caching. It can all fit simultaneously in RAM without issue. – Alexander Mar 19 '18 at 22:56
  • " Once that finished, the second network request" why after? The network requests can be concurrent, only the merging at the end needs to wait for everything before it to finish. – Alexander Mar 19 '18 at 22:56
  • As I understand, RAM will delete the information once it's not needed anymore. So if I save it to the RAM, once the app is closed for a longer time, it will delete that information once again and it's user-unfriendly again. Am I wrong? And how do I fire off network requests simoultaneously? – Thomas Mar 20 '18 at 07:37
  • Oh I see. Yes, your apps RAM will be flushed after inactivity, so you need to persist this stuff. My understanding of the question was that you wanted to somehow use caching to speed up the 5 second download process, which is not something that would help. Although 5 seconds to process only 3000 objects sounds incredibly long. There's definitely some performance oversight in there – Alexander Mar 20 '18 at 15:58

0 Answers0