kostiakoval/Mirror

Create new instance from Mirror

Closed this issue · 1 comments

Something like this would be great:

struct Person {
  let name: String
  var age: Int
}

var person = Person(name: "Jon", age: 27)
var mirror = Mirror(person)
// make some changes to mirror
var person2 = Person(mirror: mirror) // a modified version of Jon

I think this is impossible in the current version of Swift