title: Why optional chaining is required in the following case if the variable type is not declare explicitly?
body: <p>I have the following extension</p>
  <pre><code>extension UIWindow {
      static var key: UIWindow! {
          if #available(iOS 13, *) {
              return UIApplication.shared.windows.first { $0.isKeyWindow }
          } else {
              return UIApplication.shared.keyWindow
          }
      }
  }
  </code></pre>
  <p>I can use it without optional chaining in the following case</p>
  <h2 id="case-1">Case 1</h2>
  <pre><code>UIWindow.key.addGestureRecognizer(UIGestureRecognizer())
  </code></pre>
  <h2 id="case-2">Case 2</h2>
  <pre><code>let key: UIWindow = UIWindow.key
  key.addGestureRecognizer(UIGestureRecognizer())
  </code></pre>
  <p>But, when use it in the following case, I will get a compiler error</p>
  <h2 id="case-3-not-working">Case 3 (Not working)</h2>
  <pre><code>let key = UIWindow.key
  // value of optional type 'UIWindow?' must be unwrapped to refer to member 'addGestureRecognizer' of wrapped base type 'UIWindow'
  key.addGestureRecognizer(UIGestureRecognizer())
  </code></pre>
  <p>May I know why it is so? Why the compiler cannot recognise <code>key</code> as <code>UIWindow</code>, without having programmer to declare its type explicitly?</p>