Skip to content

Releases: Wasappli/WAMapping

Improved swift compatibility

30 Aug 13:44
Compare
Choose a tag to compare
  • added nullability
  • fixed some documentation

WatchOS support

22 Apr 15:46
Compare
Choose a tag to compare

Updated spec for watchOS support

Cleaned mapped objects

21 Mar 19:22
Compare
Choose a tag to compare

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

18 Mar 12:02
Compare
Choose a tag to compare

Modified code to support iOS 7 and 8

Added NSProgress

17 Mar 23:35
Compare
Choose a tag to compare
  • 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

29 Feb 18:12
Compare
Choose a tag to compare
  • 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 turn strings to NSDate
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

26 Feb 17:40
Compare
Choose a tag to compare
  • Exposed the store on WAMapper
  • Added a new store: WANSCodingStore