title: Swift KeyPath on optional value
body: <p>If I have </p>
  
  <pre><code>class Info {
      var name: String?
  }
  
  class User {
      var info: Info?
  }
  
  class WrappedClass {
      var user: User = User()
  }
  
  
  let nameKeyPath = \WrappedClass.user.info?.name //Gets me KeyPath
  let referencedNameKeyPath = \WrappedClass.user.info!.name //Gets me ReferenceWritableKeyPath
  </code></pre>
  
  <p><code>nameKeyPath</code> gets me a <code>KeyPath</code> which I can't later on use to modify the name value, but if I force unwrap it I get a <code>ReferenceWritableKeyPath</code> which is what I'm after.</p>
  
  <p>Unfortunately using <code>referencedNameKeyPath</code> with a nil value along the line expectedly crashes, due to unexpectedly finding nil.</p>
  
  <p>My question is is there a way to convert the <code>KeyPath</code> to a <code>ReferenceWritableKeyPath</code> or somehow unwrap it along the way?</p>