swift - How to filter JSON dictionary in SwiftyJSON -
i'm using swiftyjson list , printing out tableview. issue can't filter dictionary, tried make loop remove unwanted elements (or pushing new element), couldn't find way remove or pushing element json type swiftyjson provides.
var filteredtriplist:json = tripslist (key: string, trip: json) in tripslist { if string(stringinterpolationsegment: trip["tripfrom"]) != searchfilter["from"]! || string(stringinterpolationsegment: trip["tripto"]) != searchfilter["to"]! { // i'm hoping line below // filteredtriplist[key.toint()!].remove() } } }
i don't know swifty json, because use native way nsjsonserialization... have guess
please change line
filteredtriplist[key.toint()!].remove()
to line
filteredtriplist.removevalueforkey(key)
and write me happened
Comments
Post a Comment