title: In Swift, how can I implement a generic system that processes a type by registering processors for different key paths?
body: <p>I want to implement a system that allows me to generically process a type by registering processors for different key paths.</p>
  <p>One trait of the system should be <code>composition</code>, so every processor should extend one common generic protocol <code>Processor</code>.</p>
  <p>Example of usage:</p>
  <pre class="lang-swift prettyprint-override"><code>struct Language {
      var name = &quot;Swift&quot;
      var version = 5.3
  }
  
  var processor = TypeProcessor&lt;Language&gt;()
  processor.add(procesor: VersionProcessor(), keypath: \.version)
  processor.add(procesor: NameProcessor(), keypath: \.name)
  
  var input = Language()
  processor.process(value: input)
  
  // Languge version:     5.3
  // Languge name:        Swift
  
  </code></pre>