iOS Swift: Delete parse array item referenced by index -
i have data stored in parse column following column keys
phone = ["iphone", "galaxy s6", "nexus"]
quantity = [20, 30, 20]
boolv = [[true, false], [true, false], [false,true]]
i presenting date in tableview format user , want give him option delete these items.
at present following this: inside tableview commiteditingstyle function
// find index value of user selected cell var indexvalue = find(phone, "iphone") // 0 // using this, can delete array elements phone quantity.removeatindex(indexvalue!) boolv.removeatindex(indexvalue!)
to delete parse using following:
object.removeobject("iphone", forkey: "phone") // works fine object.removeobject("self.quantity[indexvalue]", forkey: "quantity") // deletes both "20" quantity table object.removeobject("self.boolv[indexvalue]", forkey: "boolv") // again deleted both "[true, false]" values form array.
i sure missing here. want delete array item pointed indexvalue. how can in parse? appreciated. thanks.
this seems should use different data model 2 classes , relationship rather 1 class , set of array attributes. then, deletion remove item relationship , delete data store.
the way have @ moment can't delete individual items array, need take array, edit , store full new updated array.
Comments
Post a Comment