3 ms·
I'm a big fan of Apple's descriptive and remarkably consistent APIs, but the combination does make autocomplete errors easy to make and hard to notice. For ins
by mjmsmith 11y ago
I'm a big fan of Apple's descriptive and remarkably consistent APIs, but the combination does make autocomplete errors easy to make and hard to notice. For instance:
- tableView:didSelectRowAtIndexPath:
- tableView:didDeselectRowAtIndexPath:
If you accidentally choose the latter, the behavior seems baffling: the first tap on an item does nothing, and every tap afterwards gives you the indexPath of the previously selected item. I'm embarrassed to admit how long I spent looking at indexPath values in the debugger and thinking "this can't be happening" before realizing what actually was happening.
- srikz 11y agoI made the same mistake a couple of times! Felt so stupid once I found the bug :-/ I still prefer long descriptive method names though. These days, I format the method so that each param goes into a newline (after Xcode autocompletes it) and this helps me catch such bugs.