title: Swift 3.0 migration error: Type 'Element' constrained to non-protocol type 'IndexPath'
body: <p>I am trying to migrate my code base to swift 3.0 using xCode. There are few issues which I am not able to understand. </p>
  
  <p>Issue: <code>Type 'Element' constrained to non-protocol type 'IndexPath'</code></p>
  
  <p><a href="https://i.stack.imgur.com/lhFlE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lhFlE.png" alt="enter image description here"></a></p>
  
  <p>In left side of error navigation panel it's shows only below errors. I am not able to understand for which line of code or branch of code causes the error.</p>
  
  <p><a href="https://i.stack.imgur.com/mJ9Q7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mJ9Q7.png" alt="enter image description here"></a></p>
  
  <p>Can anyone help me to solve this please.</p>
  
  <blockquote>
    <p>UPDATE</p>
  </blockquote>
  
  <p>After struggling a lot I am stuck at these issues.</p>
  
  <p><a href="https://i.stack.imgur.com/u2ENS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/u2ENS.png" alt="enter image description here"></a></p>
  
  <blockquote>
    <p>UPDATE</p>
  </blockquote>
  
  <p>Thank you all for your help. Now I faced only the following issues.</p>
  
  <p><a href="https://i.stack.imgur.com/FgK0J.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FgK0J.png" alt="enter image description here"></a></p>
  
  <p>Few of you are asking to post the source code but Xcode didn't show any kind of warning or error on pages. There are few generics</p>
  
  <pre><code>private extension Array where Element: IndexPath {
  
      func indexOf(_ indexPath: IndexPath) -&gt; Int {
          var counter = 0
          for object in self {
              if object.section == indexPath.section &amp;&amp; object.row == indexPath.row {
                  return counter
              }
              counter += 1
          }
          return 0
      }
  }
  
  
  fileprivate func &lt; &lt;T : Comparable&gt;(lhs: T?, rhs: T?) -&gt; Bool {
    switch (lhs, rhs) {
    case let (l?, r?):
      return l &lt; r
    case (nil, _?):
      return true
    default:
      return false
    }
  }
  </code></pre>