deep copy for array of objects in swift
问题 I have this class named Meal class Meal { var name : String = "" var cnt : Int = 0 var price : String = "" var img : String = "" var id : String = "" init(name:String , cnt : Int, price : String, img : String, id : String) { self.name = name self.cnt = cnt self.price = price self.img = img self.id = id } } and I have an array of Meal : var ordered = [Meal]() I want to duplicate that array and then do some changes to the Meal instances in one of them without changing the Meal instances in the