Last active
July 1, 2020 07:02
-
-
Save chaitanyaSoni96/14e12fd25540d5b550eabef98b49f08f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//logic | |
NSMutableArray* tempArray = [NSMutableArray new]; | |
for (NSDictionary* custumerDetails in tempArrayCustomers) { | |
NSMutableDictionary *prunedDictionary = [NSMutableDictionary dictionary]; | |
for (NSString * key in [custumerDetails allKeys]) | |
{ | |
if (![[custumerDetails objectForKey:key] isKindOfClass:[NSNull class]]){ | |
[prunedDictionary setObject:[custumerDetails objectForKey:key] forKey:key]; | |
}else{ | |
[prunedDictionary setObject:@"" forKey:key]; | |
} | |
} | |
[tempArray addObject:prunedDictionary]; | |
} | |
tempArrayCustomers = [tempArray copy]; | |
//method | |
-(NSMutableArray*)pruneArrayOfDictionaries:(NSMutableArray*)arrayToPrune{ | |
NSMutableArray* tempArray = [NSMutableArray new]; | |
for (NSDictionary* custumerDetails in arrayToPrune) { | |
NSMutableDictionary *prunedDictionary = [NSMutableDictionary dictionary]; | |
for (NSString * key in [custumerDetails allKeys]) | |
{ | |
if (![[custumerDetails objectForKey:key] isKindOfClass:[NSNull class]]){ | |
[prunedDictionary setObject:[custumerDetails objectForKey:key] forKey:key]; | |
}else{ | |
[prunedDictionary setObject:@"" forKey:key]; | |
} | |
} | |
[tempArray addObject:prunedDictionary]; | |
} | |
return tempArray; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (key, value) in CustomerDetails{ | |
let keyInDict = key as! String | |
if let valueInDict = value as? String{ | |
}else{ | |
CustomerDetails.setValue("", forKey: keyInDict) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment