title: Swift: Initialize objects from string
body: <p>I defined a struct in my model, similar to</p>
  
  <pre><code>struct MyObject {
      var ID: Int
      var name: String
  }
  </code></pre>
  
  <p>Now in code I would create objects like the following:</p>
  
  <pre><code>let newObj = MyObject(ID: 3, name: "AAAA")
  </code></pre>
  
  <p>I need to create some objects on runtime now based on a string input. I.e. I would like to provide a string like <code>'MyObject(ID: 3, name: "AAAA")'</code> and create an object from it. Is that somehow possible?</p>