0

In Swift Array is struct, so when I assign an array to another array of another Object, the value of this array will be copied to another one.
For example:

class File {
   var subFile: [File]?
}

let file = File(file:foo)
file.subFile = otherarray

How can I assign Array type in reference?
Thanks in advance

Victor Sigler
  • 23,243
  • 14
  • 88
  • 105
Thinh Vu
  • 61
  • 6
  • 1
    Your code makes no sense(it doesn't compile) so your question is completely unclear. What does "How can I assign Array type in reference?" mean? What _result_ are you trying to achieve? – matt Mar 25 '16 at 16:24
  • I think the @matt comment is valid. Why do you need to copy the reference? Explain more about your issue – Victor Sigler Mar 25 '16 at 16:28
  • Wrap the array in a class. – Darko Mar 26 '16 at 06:19

0 Answers0