Releases: Wasappli/WAMapping
Releases · Wasappli/WAMapping
Improved swift compatibility
- added nullability
- fixed some documentation
WatchOS support
Updated spec for watchOS support
Cleaned mapped objects
Fixed issues with relation ships when relation ship objects also have relation ship.
When you are mapping one object type from representation, you only get the array of those objects on first hierarchy level. Previously, you'd get every objects mapped in the process.
Fixed support for iOS 7-8
Modified code to support iOS 7 and 8
Added NSProgress
- Added
NSProgress
support
You can track progress using
[mapper.progress addObserver:self
forKeyPath:NSStringFromSelector(@selector(fractionCompleted))
options:NSKeyValueObservingOptionNew
context:NULL];
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context {
if ([keyPath isEqualToString:NSStringFromSelector(@selector(fractionCompleted))] && [object isKindOfClass:[NSProgress class]]) {
NSLog(@"Mapping progress = %f", [change[@"new"] doubleValue]);
} else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
It also supports cancellation
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
[mapper mapFromRepresentation:JSON mapping:employeeMapping completion:^(NSArray *mappedObjects, NSError *error) {
NSLog(@"Mapped objects %@ - Error %@", mappedObjects, error);
}];
});
[mapper.progress cancel];
- Added a basic sample on view controller
Added default mapping blocks
- Added
WANSCodingStore
to the main header - Added a way to register default mapping block for specific classes.
For example, you can now add a default mapping block to turnstrings
toNSDate
id(^toDateMappingBlock)(id ) = ^id(id value) {
if ([value isKindOfClass:[NSString class]]) {
return [defaultDateFormatter dateFromString:value];
}
return value;
};
[mapper addDefaultMappingBlock:toDateMappingBlock
forDestinationClass:[NSDate class]];
Added NSCoding store
- Exposed the store on
WAMapper
- Added a new store:
WANSCodingStore