avec la version dernière Xcode (GM) Je vais avoir beaucoup d'erreurs construire mon projet avec la version précédente ne tachetée comme le code suivantXcode 6 GM - NSFetchedResultsSectionInfo
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
let sectionInfo = self.fetchedResultsController.sections[section] as NSFetchedResultsSectionInfo
println("numberOfRowsInSection: \(self.entityName()) : \(sectionInfo.numberOfObjects)")
return sectionInfo.numberOfObjects
}
Je réécris ce qui suit :
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
//#warning Incomplete method implementation -- Return the number of items in the section
if let sectionInfo = fetchedResultsController.sections {
println("numberOfRowsInSection: \(self.entityName()) : \(sectionInfo[section].numberOfObjects)")
return sectionInfo[section].numberOfObjects
}
return 0
}
Y a-t-il une meilleure façon d'écrire cela?
NSFetchedResultsSectionInfo est un protocole, pas une classe. – quellish