Originally created by @markkrenek on GitHub (Jan 5, 2016).
Originally assigned to: @JohnEstropia on GitHub.
How do we get access to NSFetchedResultsController's sectionIndexTitles and sectionForSectionIndexTitle when using a sectioned list?
Originally created by @markkrenek on GitHub (Jan 5, 2016).
Originally assigned to: @JohnEstropia on GitHub.
How do we get access to NSFetchedResultsController's sectionIndexTitles and sectionForSectionIndexTitle when using a sectioned list?
adam
added the fixed label 2025-12-29 15:22:31 +01:00
@markkrenek There's currently no interface to expose these (yet). Let me push an update within the day.
If you need to, you can workaround with these:
Getting Section Index Titles:
letmonitor=// ... ListMonitorletsectionIndexTitles:[String]=(0..<monitor.numberOfSections()).map({monitor.sectionInfoAtIndex($0)}).map({$0.indexTitle??""})// Apple's documentation states:// "The default implementation returns the array created by calling sectionIndexTitleForSectionName: on all the known sections."// which is similar to what we're doing here
@JohnEstropia commented on GitHub (Jan 6, 2016):
@markkrenek There's currently no interface to expose these (yet). Let me push an update within the day.
If you need to, you can workaround with these:
Getting Section Index Titles:
``` swift
let monitor = // ... ListMonitor
let sectionIndexTitles: [String] = (0 ..< monitor.numberOfSections())
.map({ monitor.sectionInfoAtIndex($0) })
.map({ $0.indexTitle ?? "" })
// Apple's documentation states:
// "The default implementation returns the array created by calling sectionIndexTitleForSectionName: on all the known sections."
// which is similar to what we're doing here
```
Getting Index for an Index Title:
``` swift
let sectionIndexTitle = "Apple"
let sectionForSectionIndexTitle: Int? = (0 ..< monitor.numberOfSections())
.lazy
.map({ monitor.sectionInfoAtIndex($0) })
.indexOf({ $0.indexTitle == sectionIndexTitle })
```
@markkrenek The workaround I posted a while ago is WRONG, sorry about that. I forgot that section indexes are independent of the sections themselves. Anyway you can access these methods from ListMonitor now:
@JohnEstropia commented on GitHub (Jan 6, 2016):
@markkrenek The workaround I posted a while ago is WRONG, sorry about that. I forgot that section indexes are independent of the sections themselves. Anyway you can access these methods from `ListMonitor` now:
``` swift
public func sectionIndexTitles() -> [String]
public func targetSectionForSectionIndex(title title: String, index: Int) -> Int
```
See https://github.com/JohnEstropia/CoreStore/commit/71c3abc4f31241e9ab95b639071cfeaacb253489 for details.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @markkrenek on GitHub (Jan 5, 2016).
Originally assigned to: @JohnEstropia on GitHub.
How do we get access to NSFetchedResultsController's sectionIndexTitles and sectionForSectionIndexTitle when using a sectioned list?
@JohnEstropia commented on GitHub (Jan 6, 2016):
@markkrenek There's currently no interface to expose these (yet). Let me push an update within the day.
If you need to, you can workaround with these:
Getting Section Index Titles:
Getting Index for an Index Title:
@JohnEstropia commented on GitHub (Jan 6, 2016):
@markkrenek The workaround I posted a while ago is WRONG, sorry about that. I forgot that section indexes are independent of the sections themselves. Anyway you can access these methods from
ListMonitornow:See https://github.com/JohnEstropia/CoreStore/commit/71c3abc4f31241e9ab95b639071cfeaacb253489 for details.
@markkrenek commented on GitHub (Jan 6, 2016):
Works great. Thanks John. I've just started experimenting with this library, and so far it is great.
@JohnEstropia commented on GitHub (Jan 6, 2016):
@markkrenek Glad it works :) Thanks for the feedback!