title: Assign dynamically properties of a Struct in Swift
body: <p>I have this Struct:  </p>
  
  <pre><code>struct Alphabet {
      let a = "ciao"
      let b = "hi"
      let c = "hola"
  }
  
  let alphabet = Alphabet()
  </code></pre>
  
  <p>I want the value of each property become the <em>string</em> of the property itself.
  Like this:</p>
  
  <pre><code>alphabet.a = "a"
  alphabet.b = "b"
  alphabet.c = "c"
  </code></pre>
  
  <p>But I want to be done regardless of the <strong>number</strong> of properties or their <strong>value</strong>:</p>
  
  <p>I tried this:</p>
  
  <pre><code>Mirror(reflecting: Alphabet.self).children.forEach { (label, value) in
      self.alphabet[keyPath: label] = label!
  }
  </code></pre>
  
  <p>but I know this is not the way KeyPath works...
  Probably there are type safety problems going on too.
  Any idea?</p>