Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with Swift #42

Open
anwol004 opened this issue Aug 6, 2015 · 8 comments
Open

Not working with Swift #42

anwol004 opened this issue Aug 6, 2015 · 8 comments

Comments

@anwol004
Copy link

anwol004 commented Aug 6, 2015

Hello i try to use this repo but this is not working in swift.

Gives an problem with the tableview.delegate downcast, has anyone solution for this problem?

Greetz

@phausero
Copy link

phausero commented Aug 6, 2015

Yeah, I think all you have to do is extending BLKDelegateSplitter with the protocol you want to use. In your case UITableViewDelegate.

@trevisthomas
Copy link

I'm pretty new to Swift and iOS and I spent a lot of hours to come to the conclusion that the break was with this class. Modifying the BLKDelegateSplitter class to conform to the UITableViewDelegate protocol fixed it for me. I have the demo running now with a Swift based view controller.

@rafalkitta
Copy link

@trevisthomas could you show your BLKDelegateSplitter conformation to the UITableViewDelegate?

@trevisthomas
Copy link

Just edit the BLKDelegateSplitter.h file. Replace the @implementation declaration at line 29 with:

@interface BLKDelegateSplitter : NSObject <NSObject, UITableViewDelegate>

@rafalkitta
Copy link

Thank you for your response. You're right.
Also @rabzu Demo in Swift pull request #20 was very helpful.

extension BLKDelegateSplitter: UICollectionViewDelegate {
}

@tgyhlsb
Copy link

tgyhlsb commented Nov 1, 2015

Hi rafalkitta,

I tried with your extension so I don't get the compiler error. But at run time, the BLKDelegateSplitter does not forward the calls to any of its sub-delegates.

Have you modify anything else to make it work ? I use Swift 2.0

@tgyhlsb
Copy link

tgyhlsb commented Nov 1, 2015

It appeared I have to make a strong reference to the splitter because tableView.delegate is weak. Why splitter was just deallocated by ARC...

Works perfectly now, great component !

@harshilkotecha
Copy link

harshilkotecha commented Dec 28, 2017

This is working fine in swift 4 also
add this extension to solve this issue this is work for me

extension BLKFlexibleHeightBarBehaviorDefiner :UITableViewDelegate{
    
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants