3lvis / DATASource

Core Data's NSFetchedResultsController wrapper for UITableView and UICollectionView
Other
106 stars 27 forks source link

Sectioned UITableView Without Indexes #57

Closed syky27 closed 8 years ago

syky27 commented 8 years ago

Hi, according to README by doing this:

func sectionIndexTitlesForDataSource(dataSource: DATASource, tableView: UITableView) -> [String] {
    return [String]()
}

You can get rid of those indexes, that is correct and it works great but, in my app this causes memory leak.

Can you please check your app using this? It might me my mistake, but right now I am not sure at all.

Thanks

3lvis commented 8 years ago

Hi @syky27,

I'm not sure how I would be able to fix that. Any ideas?

syky27 commented 8 years ago

Well, same here basically it would be nice if the return value could be optional. So when you would not want any indexes you could return nil in sectionIndexTitlesForDataSource. But clearly, when I comment out that code, the memory leaks disappear.

I tried setting it up to optional return value but the indexes got rendered.

The weird thing I cannot wrap my head around is that DATASource+UITableViewDataSource line 29 public func sectionIndexTitlesForTableView(tableView: UITableView) -> [String]? { gets called twice for some reason...

3lvis commented 8 years ago

@syky27 That delegate doesn't return an optional because I didn't found a way to do this if/else dance using an optional.

https://github.com/3lvis/DATASource/blob/master/Source/DATASource%2BUITableViewDataSource.swift#L29-L32

The method in line 29 is from UITableViewDataSource, just that DATASource overwrites all those delegates in order to provide some automatic functionality.

3lvis commented 8 years ago

Closing this one until we find a good way to do it.

syky27 commented 8 years ago

That's exactly why it should be opened, but whatever :)

On 04 May 2016, at 15:10, Elvis Nuñez notifications@github.com wrote:

Closing this one until we find a good way to do it.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

3lvis commented 8 years ago

@syky27 sorry, I'll rephrase:

Closing this one since doesn't seem to be a good way to fix this.