0

As we know, we implement Delegates for custom actions in another class and we implement DataSources for supplying custom data to a class. But why we can implement UITableViewDelegate methods in UITableViewDataSource extension? like below image. If I`m not mistaken I have to implement didDeselect method in UITableViewDelegate instead of UITableViewDataSource but Xcode allows me to do that. Please guide me. Thank you

enter image description here

2
  • 2
    extensions are what you write for convenience. If you remove the first extension and try, it won't show up. Since your have already implemented the protocol in the extension before this one, it is also a part of this one. (Actually everything is part of the same class that you make) You can also implement delegates of this Protocol in that extension that you made. Aug 26, 2018 at 11:09
  • Oh yeah, I got your point. Thank you Rakesha Shastri Aug 26, 2018 at 11:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.