title: Swift delegation - when to use weak pointer on delegate
body: <p>Can someone explain when and when not to use a 'weak' assignment to a delegate pointer in Swift, and why? </p>
  
  <p>My understanding is that if you use a protocol that is not defined as a class you cannot, nor want to, assign your delegate pointer to weak.</p>
  
  <pre><code>protocol MyStructProtocol{
      //whatever
  }
  
  struct MyStruct {
      var delegate: MyStructProtocol?
  }
  </code></pre>
  
  <p>However, when your protocol is defined as a class type protocol then you DO want to set your delegate to a weak pointer?</p>
  
  <pre><code>protocol MyClassProtocol: class{
      //whatever
  }
  
  class MyClass {
      weak var delegate: MyClassProtocol?
  }
  </code></pre>
  
  <p>Am I correct? In Apple's swift guide there class protocol examples aren't using weak assignments, but in my testing I'm seeing strong reference cycles if my delegates aren't weakly referenced.</p>