modify an array within a function does not work

前端 未结 4 872
情深已故
情深已故 2021-01-27 12:00

I call a function to process and modify an array. But the array does not change at all. Looks like a Swift major bug ???

var Draw_S = [String]();
var Draw_E =          


        
4条回答
  •  独厮守ぢ
    2021-01-27 12:26

    Both String and Array are value types in Swift. That is the reason why it is not modified inside a method. You would need to return the modified array back from the method.

提交回复
热议问题