Question

I'm in a place were I know how to build apps and have submitted at least 5 for different clients to the app store and wanted to step up my game. So of course I went to Apple resources and analyse the code deeply (I've used Apple code resources before but just to find answers and move on). And I realised their code is really different from any other iOS Dev I know. Example: https://developer.apple.com/library/prerelease/ios/samplecode/LazyTableImages/Introduction/Intro.html#//apple_ref/doc/uid/DTS40009394

Is this how you guys would load a tableView with images and names? I think something like this wouldn't even come across my mind when thinking on how to do it.

Was it helpful?

Solution

Apple's sample code is just that, sample code. No guarantee that it works, that it is bug free, that it is the best way to achieve something. Use it to study some area that you don't know much about, until you are knowledgable in that area by yourself. And then throw the sample code away.

Which is what you should do with any code that you find on the Internet.

In this case, the structure of the downloading code is nice. I'd save the icons in the tmp directory, and I would prepare for the table view changing while a download is running, and I would just invalidate a row of the tableview instead of modifying the cell. On the other hand, their code to avoid downloading while scrolling, and to avoid multiple downloads of the same data, that is nice.

So while everyone has his own style, their sample code will send you into the right direction.

Licensed under: CC-BY-SA with attribution
scroll top