0

As 99% of iOS apps, mine has a main screen with a long list of items, and when a user taps one, he sees item details. Pretty much straightforward. Let's say, to render the first screen I need titles and images. And for the second one - a large html. All the data is stored persistently in CoreData.

I want the list (UICollectionView) to be as fast as possible. So I can't load html-s until a user is on the details screen.

How can it be implemented? Should I create two NSManagedObject classes: Item and ItemDetails? Does CoreData load everything lazily?

Artem Stepanenko
  • 3,423
  • 6
  • 29
  • 51

1 Answers1

1

Splitting it into Item and ItemDetails is a good approach.

I'd check first, though, if it's really a performance problem. You want to be sure to understand how setting a batch size affects fetch performance. The Accessing Data and Performance chapters in our Core Data book goes into all the details.

Daniel Eggert
  • 6,665
  • 2
  • 25
  • 41
  • Thanks, Daniel. I'm really going to buy this book. But, in short, is there a way to be always on a safe side? Even if one day I had an item with 1 Mb html. – Artem Stepanenko Dec 18 '15 at 17:05
  • Yes, if the data is big, using `Item` and `ItemDetails` with a one-to-one relationship is the best approach. – Daniel Eggert Dec 18 '15 at 17:06