Ios 按键路径修改NSMutableDictionary
我有一个带有嵌套的Ios 按键路径修改NSMutableDictionary,ios,objective-c,plist,kvc,Ios,Objective C,Plist,Kvc,我有一个带有嵌套的NSDictionary/NSArray(通过JSON生成)的NSDictionary 我需要根据一些强加给我的逻辑,在多个地方移除对象 例如,假设字典有如下结构: { "Array1" : [ { "InnerArray1" : [ { "some conditional field" : Evaluate this ... }
NSDictionary/NSArray
(通过JSON生成)的NSDictionary
我需要根据一些强加给我的逻辑,在多个地方移除对象
例如,假设字典有如下结构:
{
"Array1" : [
{
"InnerArray1" : [
{
"some conditional field" : Evaluate this ...
}
],
"More Properties : ....
}
],
"Array2" : {
... some complex inner structure
{
// some inner object to remove according to "evaluate condition"
}
}
}
当我迭代“Array1.InnerArray1…
”并将某些条件求值为true
”时,我需要删除不相交位置中的对象
理想情况下,我可以做类似的事情
foreach item in Array1.InnerArray1 {
if item evaluates to true {
// evaluate the disjoint location...
remove Array2.....InnerObject(s) where ConditionField == true
}
}
目前,迭代内部对象并在同一过程中对其进行变异是非常困难的(而且很难读取)
假设我已经创建了整个数据树的深层可变副本,那么是否可以使用kvc
或其他不需要嵌套迭代的机制来删除嵌套对象