Filter Array con dictionarys usando NSPnetworkingicate

Hay una Matriz con cada elemento siendo un NSDictionary .

 NSMutableArray *mutArr = [NSMutableArray array]; for (Person *person in persons) { NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:person.name, @"name", person.email, @"email", nil]; [mutArr addObject:dict]; } self.arr = [[NSArray alloc] initWithArray:mutArr]; 

Cómo archivar el arr con nombre o correo electrónico contiene cadena @"filter string" utilizando filterArrayUsingPnetworkingicate: method.

¡Gracias por adelantado!

Consulte el ejemplo a continuación … puede ayudarlo …

  NSArray *array = [NSArray arrayWithObject:[NSMutableDictionary dictionaryWithObject:@"filter string" forKey:@"email"]]; // you can also do same for Name key... NSArray *filtenetworkingarray = [array filtenetworkingArrayUsingPnetworkingicate:[NSPnetworkingicate pnetworkingicateWithFormat:@"(email == %@)", @"filter string"]]; 

Espero que te ayude a … disfrutar

Mira esto :

 var customerNameDict = ["firstName":"karthi","LastName":"alagu","MiddleName":"prabhu"]; var clientNameDict = ["firstName":"Selva","LastName":"kumar","MiddleName":"m"]; var employeeNameDict = ["firstName":"karthi","LastName":"prabhu","MiddleName":"kp"]; var attributeValue = "karthi"; var arrNames:Array = [customerNameDict,clientNameDict,employeeNameDict]; var namePnetworkingicate = NSPnetworkingicate(format: "firstName like %@",attributeValue); let filtenetworkingArray = arrNames.filter { namePnetworkingicate.evaluateWithObject($0) }; println("names = ,\(filtenetworkingArray)");