Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
3lvis committed Nov 27, 2015
1 parent b716a50 commit 45c2f9a
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions Source/DATASource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -336,18 +336,9 @@ extension DATASource: UICollectionViewDataSource {
request.predicate = self.fetchedResultsController.fetchRequest.predicate
request.sortDescriptors = [NSSortDescriptor(key: keyPath, ascending: ascending!)]

var objects: [NSDictionary]?

do {
objects = try self.fetchedResultsController.managedObjectContext.executeFetchRequest(request) as? [NSDictionary]
} catch {
print("Error")
}

if let objects = objects {
for object in objects {
self.cachedSectionNames.appendContentsOf(object.allValues)
}
let objects = try! self.fetchedResultsController.managedObjectContext.executeFetchRequest(request) as! [NSDictionary]
for object in objects {
self.cachedSectionNames.appendContentsOf(object.allValues)
}
}

Expand All @@ -357,11 +348,8 @@ extension DATASource: UICollectionViewDataSource {
return view
}

if let headerView = collectionView.dequeueReusableSupplementaryViewOfKind(UICollectionElementKindSectionHeader, withReuseIdentifier: DATASourceCollectionViewHeader.Identifier, forIndexPath: indexPath) as? DATASourceCollectionViewHeader {
if let title = title as? String {
headerView.title = title
}

if let headerView = collectionView.dequeueReusableSupplementaryViewOfKind(UICollectionElementKindSectionHeader, withReuseIdentifier: DATASourceCollectionViewHeader.Identifier, forIndexPath: indexPath) as? DATASourceCollectionViewHeader, let title = title as? String {
headerView.title = title
return headerView
}
}
Expand Down

0 comments on commit 45c2f9a

Please sign in to comment.