ios - Array with reference type -


array value type hence copies data.

var arrayone  = [uiview(), uiview()] var arraytwo = arrayone arrayone.first!.alpha = 0.5 arraytwo.first!.alpha // how becomes 0.5? 

but arraytwo.first!.alpha prints 0.5 not 1 please explain why?

in swift, array value type - results of arrayone copied arraytwo. however, uiview reference type, references copied. references still point original uiview why seeing behaviour.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -