Skip to content

Instantly share code, notes, and snippets.

@vikdenic
Created March 2, 2015 21:00
Show Gist options
  • Select an option

  • Save vikdenic/830e3cd233005c41692a to your computer and use it in GitHub Desktop.

Select an option

Save vikdenic/830e3cd233005c41692a to your computer and use it in GitHub Desktop.
if error == nil
{
let mostRecentMessage = self.messages.first
var indexPathArray = [NSIndexPath]()
var index = 0
for tweet in tweetMessages
{
//If any new tweets are found, add them to the array
if tweet.bornOn!.compare(mostRecentMessage!.bornOn!) == NSComparisonResult.OrderedDescending
{
self.messages.insert(tweet, atIndex: index)
indexPathArray.insert(NSIndexPath(forItem: index, inSection: 0), atIndex: index)
index++
}
self.collectionView.insertItemsAtIndexPaths(indexPathArray)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment