title: Get all key paths from a struct in Swift 4
body: <p>Let's say I have that struct:</p>
  
  <pre><code>struct MyStruct {
      let x: Bool
      let y: Bool
  }
  </code></pre>
  
  <p>In Swift 4 we can now access it's properties with the <code>myStruct[keyPath: \MyStruct.x]</code> interface.</p>
  
  <p>What I need is a way to access all it's key paths, something like:</p>
  
  <pre><code>extension MyStruct {
  
      static func getAllKeyPaths() -&gt; [WritableKeyPath&lt;MyStruct, Bool&gt;] {
          return [
              \MyStruct.x,
              \MyStruct.y
          ]
      }
  
  }
  </code></pre>
  
  <p>But, obviously, without me having to manually declare every property in an array.</p>
  
  <p>How can I achieve that?</p>