I watched Swift Talk episode 32, View Models at Kickstarter. The video demonstrates how to create View Model. The View Model is very well defined. Simple example, and very clear explanation!

The following is my note for it.

  • Array vs ArraySlice
  • split(batchSize:) function.
  • Swift.min()
  • Use startIndex and endIndex.
  • ArraySlice is not guaranteed that it starts from index 0.
  • stride() function requires that index is integer type, meaning type should be Strideable.
  • Collection protocol doesn’t have Element type. Iterator.Element.
  • Collection’s subscript return Subsequence type.
  • Use IndexDistance instead of Int for split(batchSize:) parameter.
  • dump() function.