johnno1962 / InjectionApp

Issue Tracking Repo for Injection as an App
MIT License
111 stars 7 forks source link

Dequeuing cells in Swift #12

Open hartbit opened 7 years ago

hartbit commented 7 years ago

In Swift, when de-queuing custom cells who's class has been swizzled causes a crash:

Could not cast value of type 'MyApp.SectionHeaderView' (0x10e9afee0) to 'MyApp.SectionHeaderView' (0x123532bb8).
johnno1962 commented 7 years ago

Intersesting.. Any chance you would be able to put together a small example project and I’ll take a look.

hartbit commented 7 years ago

I’ll try this evening.

On 17 Jan 2017, at 14:50, John Holdsworth notifications@github.com wrote:

Intersecting. Any change you would be able to put together a small example project and I can look into it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johnno1962/InjectionApp/issues/12#issuecomment-273164304, or mute the thread https://github.com/notifications/unsubscribe-auth/AAT3jyEIgcpd5fI57k5XLS7N93MgR_Wjks5rTMcWgaJpZM4Llq1H.

johnno1962 commented 7 years ago

Cheers, I have an idea what it is but not quite what to do about it. Swizzled instance has different “isa"

hartbit commented 7 years ago

Yeah, was thinking the same, and it doesn't work with a Swift runtime cast.

johnno1962 commented 7 years ago

I found I could only replicate this when the cell class was in the same file as the UITableViewController subclass. Could this be the solution?

hartbit commented 7 years ago

I'm in that case!