dimanche 2 février 2020

Init class/struct inner variables with array?

I have a typical struct/class with inner variables and an array of input values.

Is it possible to create another array of pointers to these variables to assign all the values like a[N] = b[N]? Or maybe are there other ways to init class/struct inner variables independently of their count? But as I understand Reflection in Swift works with read-only values

Example for those who doesn't understand what "struct", "class" and "array" mean and downvotes this question

struct A {
  var a1: String
  var a2: String?
  var a3: String?
  init(with array: [String]) {
    ...
  }
}




Aucun commentaire:

Enregistrer un commentaire