Skip to content

Instantly share code, notes, and snippets.

@thomasdegry
Created April 22, 2015 22:01
Show Gist options
  • Save thomasdegry/6734f763fba5fa17ce96 to your computer and use it in GitHub Desktop.
Save thomasdegry/6734f763fba5fa17ce96 to your computer and use it in GitHub Desktop.
collectionView.performBatchUpdates({ () -> Void in
if components.weekOfYear < 0 {
collectionView.deleteSections(NSIndexSet(indexesInRange: NSRange(location: collectionView.numberOfSections() - abs(components.weekOfYear), length: abs(components.weekOfYear))))
collectionView.insertSections(NSIndexSet(indexesInRange: NSRange(location: 0, length: abs(components.weekOfYear))))
} else {
collectionView.insertSections(NSIndexSet(indexesInRange: NSRange(location: collectionView.numberOfSections(), length: abs(components.weekOfYear))))
collectionView.deleteSections(NSIndexSet(indexesInRange: NSRange(location: 0, length: abs(components.weekOfYear))))
}
}, completion: { (finished) -> Void in
println("finished batch update")
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment