Reusable icon indicating copy to clipboard operation
Reusable copied to clipboard

Add the old way to dequeue cell without path

Open PoissonBallon opened this issue 9 years ago • 4 comments

PoissonBallon avatar Nov 21 '16 13:11 PoissonBallon

🤔 Isn't this method deprecated since iOS6-7?

If you want to add cells, even at the end of a tableView, the docs suggests to use the new method now iirc. You always have the indexPath anyway, as you're only supposed to call theses dequeue… method in the implementation of cellForRowAtIndexPath: which provides you the indexPath you need, so I don't even seen which cases you'd need that old and deprecated method?

Besides, if you use this old method, there's no guarantee that it won't return nil if there is no cell in the reuse pool to reuse — as opposed to the new method which instantiate that cell if there is none available to reuse. And if that old method returns nil you're then supposed to alloc/init the cell with the reuseIdentifier yourself, right?… for which Reusable don't propose a method either. and not supposed to crash…

AliSoftware avatar Nov 21 '16 14:11 AliSoftware

Hey @AliSoftware and thx for your quick answer

For information, dequeueReusableCell(withIdentifier:) isn't deprecated (yet), and I agree with you it's better to use dequeueReusableCell(withIdentifier:for:) https://developer.apple.com/reference/uikit/uitableview/1614891-dequeuereusablecell

And FYI my error it's same of this : newly visible row issue (Apple) && newly visible row issue (sf)

And the only one fix I found was the use of dequeueReusableCell(withIdentifier:)

I am totally open if you have any another option and keep Reusable usage 😄

PoissonBallon avatar Nov 21 '16 14:11 PoissonBallon

Problem is, that seems to be a bug to me and the aim of Reusable being to have more modern API it seems strange to me to introduce an old one especially if it's too use as a workaround and not a documented use… but I see your problem.

The fact that an empty recycle pool would make it crash that's not there right option anyway.

AliSoftware avatar Nov 21 '16 19:11 AliSoftware

Ok, I see your pov but there is almost no difference between there iirc (one returns nil and the other crash if we have no register cell) Anyway if you think we don't need this in Reusable you can close the PR 😄

Thanks for your return 👍

PoissonBallon avatar Nov 21 '16 19:11 PoissonBallon