DenTelezhkin / DTTableViewManager

Protocol-oriented UITableView management, powered by generics and associated types.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with programmatically added tableView

EngrAhsanAli opened this issue · comments

Hi!

I tried to wrapping DTTableViewManager and providing dynamically added UITableView. So when added addSubview(tableView) the following delegate needs some time to wait for its addition.

self.manager.startManaging(withDelegate: self)

However, I made the workaround which works well, but of course, it's not preferable.

DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
       self.manager.startManaging(withDelegate: self)
} 

Any good way to deal with programmatically added UITableView in class extended from NSObject?

Hi!

What makes you think that you need to wait some time before calling startManaging(withDelegate:)?

Hello!

I use to get the following error sometimes but now it's working well, closing this thread with an excuse! Thanks anyway!

Call startManagingWithDelegate: method only when UITableView has been created