class Test: NSObject {
var product_id: String
var size: String
var color: String
var desc: String
var name: String
init(arr: [String]) {
product_id = arr[0]
size = arr[1]
color = arr[2]
desc = arr[3]
name = arr[4]
}
}
let t1 = Test(arr: ["1", "S", "Blue", "111", "第一个商品"])
let t2 = Test(arr: ["1", "S", "Blue", "333", "第三个商品"])
let t3 = Test(arr: ["1", "S", "Blue", "666", "第六个商品"])
let t4 = Test(arr: ["1", "S", "Blue", "777", "第七个商品"])
let t5 = Test(arr: ["2", "S", "Blue", "222", "第二个商品"])
let t6 = Test(arr: ["2", "S", "Blue", "555", "第五个商品"])
let t7 = Test(arr: ["3", "S", "Blue", "444", "第四个商品"])
let initialSWSet = Set([t1, t2, t3, t4, t5, t6, t7])
initialSWSet.count
I expect initialSWSet.count == 3, in other words , if a test's product_id, size, color is same the test is same。 t1 == t2 == t3 == t4; t5 == t6; t7 how can i achieve the work? Thank advance!