mardi 31 mars 2020

Can I use Swift's Mirror to access subtypes?

If I've nested types, such as

struct Foo {
  let foo = Bar()

  struct Bar {
    let bar = 1
  }

  struct OtherBar {
    let bar = 1
  }
}

can I use Mirror to reflect the list of subtypes of foo? Mirror(reflecting: Foo.self).children only contains the property 'foo'





Aucun commentaire:

Enregistrer un commentaire