Skip to content

Commit f3bda62

Browse files
author
Ricardo Pramana Suranta
committed
Add extra copyWithZone logic on JSONAPIResource
copy all values if object's __dictionary is empty
1 parent a51bf2e commit f3bda62

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Classes/JSONAPIResource.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,15 @@ - (id)copyWithZone:(NSZone *)zone {
219219

220220
}
221221

222+
BOOL isEmptyDictionary = !self.__dictionary || self.__dictionary.count == 0;
223+
224+
if (isEmptyDictionary) {
225+
for (NSString *key in self.propertyKeys) {
226+
id selfValue = [self valueForKey:key];
227+
[copy setValue:selfValue forKey:key];
228+
}
229+
}
230+
222231
return copy;
223232
}
224233

0 commit comments

Comments
 (0)