2014-09-21 12 views

Odpowiedz

11

Trzeba rzucić self.fetchedResultsController?.sections do Array z NSFetchedResultsSectionInfo obiektów:

if let s = self.fetchedResultsController?.sections as? [NSFetchedResultsSectionInfo] 

Następnie można przejść section do t że indeks i uzyskać liczbę obiektów:

if let s = self.fetchedResultsController?.sections as? [NSFetchedResultsSectionInfo] { 
    d = s[section].numberOfObjects 
} 
3

Myślę, że obecnie akceptowane odpowiedź Mike S wstępnie Swift 2.0

Poniższy pracuje dla mnie (Swift 2.1):

if let sections = fetchedResultsController?.sections { 
    return sections[section].numberOfObjects 
} else { 
    return 0 
} 
Powiązane problemy