MotoGP swift library sample

Working on one of our latest iOS projects we discovered an useful Swift library, Dwifft, created by jflinter.

This library is able to update the content  of a tableView (or a collectionView) without refreshing the whole view, which would be an expensive operation. It uses the Longest Common Subsequence algorithm (more about it on Wikipedia) on two different data collections to find the fewer changes needed to display the new data. In other words, starting from the input data (a Swift Datasource) the library calculates the minimum number of insertions, deletions and movements needed in order to correctly display the updated datasource.

While we were looking for an example implementation of this library, we realized that the example written by its creator wasn’t really able to unveal its full potential, as it was working on an array of strings. So, as we usually do when we can’t find something that we need, we created an example app on our own and we thought it would be nice to share it with you.

So, what’s this fabulous app all about? It simulates the qualifications of a MotoGP race and shows them in real time. To do that, there is a random ranking generator running every few seconds, then Dwifft does all the heavy-lifting and helps us display the overtakes in a smooth way.

All the details and the code can be found here.



  • Blog
  • iOS
  • Senza categoria

Tecnologie utilizzate

  • foo
  • bar