title: Protocol extension vs class extension in Swift
body: <p>Assume there is a protocol <code>Draggable</code>, usually will be conformed by an <code>UIView</code> object 
  </p>
  
  <pre><code>protocol Draggable {
    drag()
  }
  </code></pre>
  
  <p>We can either implement <code>drag()</code> in a protocol extension as <code>option 1</code>
  </p>
  
  <pre><code>// option 1
  extension Draggable where Self: UIView {
    func drag() {
      // implementation
    }
  }
  extension UIView: Draggable {} // added after @Rich Tolley's answer
  </code></pre>
  
  <p>Or we can implement <code>drag()</code> in a <code>UIView</code> extension as <code>option 2</code>
  </p>
  
  <pre><code>// option 2
  extension UIView: Draggable {
    func drag() {
      // implementation
    }
  }
  </code></pre>
  
  <h2>Here is my question:</h2>
  
  <ul>
  <li>Is there a difference between these two approaches (option 1 &amp; option 2) ?</li>
  <li>If yes, what's the difference and how to choose when we design a our project or library ?</li>
  </ul>
  
  <p><strong>And idea</strong> would be helpful.</p>