title: How to group by the elements of an array in Objective C
body: <p>As mentioned here is possible with swift to How to group by the elements of an array : <a href="https://stackoverflow.com/questions/31220002/how-to-group-by-the-elements-of-an-array-in-swift/31220067#31220067">How to group by the elements of an array in Swift</a> using this extension :</p>
  
  <pre><code>public extension SequenceType {
  
    /// Categorises elements of self into a dictionary, with the keys given by keyFunc
  
    func categorise&lt;U : Hashable&gt;(@noescape keyFunc: Generator.Element -&gt; U) -&gt; [U:[Generator.Element]] {
      var dict: [U:[Generator.Element]] = [:]
      for el in self {
        let key = keyFunc(el)
        if case nil = dict[key]?.append(el) { dict[key] = [el] }
      }
      return dict
    }
  }
  </code></pre>
  
  <p>How to do the same with Objective C</p>