5

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.

  • I believe you would get better answers if you shape your question like so: " I have seen this implementation on Apple's website {IMPLEMENTATION}, this is what I would usually do myself: {YOUR CODE}. Questions: what code would you consider more efficient? Which code would you consider more maintainable? Etc... – Alexus Jun 25 '15 at 5:19
6

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.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.