title: Weak property deallocation confusion
body: <p>I'm using a third party library and it required setting a delegate. In this scenario I want to set the delegate to be another class so I go to write</p>
  
  <pre><code>ThirdPartyLibrary.delegate = MyDelegateHandlerClass()
  </code></pre>
  
  <p>But Xcode (Xcode 10 beta) gives me a warning saying:</p>
  
  <blockquote>
    <p>Instance will be immediately deallocated because property ‘delegate’
    is ‘weak’</p>
  </blockquote>
  
  <p>Clicking into the <code>delegate</code> of the third party library I see that it is indeed defined as <code>weak</code> as follows:</p>
  
  <pre><code>@property (weak, nonatomic) id&lt;ThirdPartyLibraryDelegate&gt; delegate;
  </code></pre>
  
  <p>However, if I change my initial setting of the delegate to:</p>
  
  <pre><code>let someInstance = MyDelegateHandlerClass()
  ThirdPartyLibrary.delegate = someInstance
  </code></pre>
  
  <p>Then I get no warning? How are these two not the same thing? Just looking for advice and an explanation really. Thanks!</p>