Skip to content

Commit

Permalink
2.0.1 dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
FredericJacobs committed Jun 24, 2015
1 parent c675c9b commit 41c8315
Show file tree
Hide file tree
Showing 45 changed files with 4,654 additions and 4,532 deletions.
16 changes: 8 additions & 8 deletions Manifest.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ PODS:
- JSQMessagesViewController (7.1.0):
- JSQSystemSoundPlayer (~> 2.0.1)
- JSQSystemSoundPlayer (2.0.1)
- libPhoneNumber-iOS (0.8.4)
- Mantle (2.0):
- Mantle/extobjc (= 2.0)
- Mantle/extobjc (2.0)
- libPhoneNumber-iOS (0.8.5)
- Mantle (2.0.2):
- Mantle/extobjc (= 2.0.2)
- Mantle/extobjc (2.0.2)
- OpenSSL (1.0.203)
- PastelogKit (1.2):
- CocoaLumberjack (~> 1.9)
Expand Down Expand Up @@ -68,8 +68,8 @@ DEPENDENCIES:
- FFCircularProgressView (>= 0.1)
- JSQMessagesViewController (from `https://github.com/WhisperSystems/JSQMessagesViewController`,
commit `e5582fef8a6b3e35f8070361ef37237222da712b`)
- libPhoneNumber-iOS (~> 0.8.2)
- Mantle (~> 2.0)
- libPhoneNumber-iOS (~> 0.8.5)
- Mantle (~> 2.0.2)
- OpenSSL (~> 1.0.203)
- PastelogKit (~> 1.2)
- SCWaveformView (~> 1.0)
Expand Down Expand Up @@ -115,8 +115,8 @@ SPEC CHECKSUMS:
HKDFKit: c058305d6f64b84f28c50bd7aa89574625bcb62a
JSQMessagesViewController: ca11f86fa68ca70835f05e169df9244147c1dc40
JSQSystemSoundPlayer: c5850e77a4363ffd374cd851154b9af93264ed8d
libPhoneNumber-iOS: dbfc7b4128510a4955df3e5a6f125393fc9ebc2f
Mantle: d7c75b6fb789b20f7ae30cd0d09435fe545896ff
libPhoneNumber-iOS: b8ccd23576379caca37c7cbdd554addf384459ed
Mantle: 967fd31ea0220890b2e76589198996b534bb3fb1
OpenSSL: 65f5de70414ee909cea517ded684d8ef855b02b4
PastelogKit: c73795b8c0bbf33ea45d3b6a5eabb373be3d5955
ProtocolBuffers: 9a4a171c0c7cc8f21dd29aeca4f9ac775d84a880
Expand Down
6 changes: 3 additions & 3 deletions Mantle/Mantle/MTLJSONAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ extern const NSInteger MTLJSONAdapterErrorInvalidJSONMapping;
/// receiver if it's implemented. It supports NSURL conversion through
/// +NSURLJSONTransformer.
///
/// class - The class of the property to serialize. This property must not be
/// nil.
/// modelClass - The class of the property to serialize. This property must not be
/// nil.
///
/// Returns a value transformer or nil if no transformation should be used.
+ (NSValueTransformer *)transformerForModelPropertiesOfClass:(Class)class;
+ (NSValueTransformer *)transformerForModelPropertiesOfClass:(Class)modelClass;

/// A value transformer that should be used for a properties of the given
/// primitive type.
Expand Down
23 changes: 8 additions & 15 deletions Mantle/Mantle/MTLJSONAdapter.m
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,9 @@ + (NSDictionary *)valueTransformersForModelClass:(Class)modelClass {
for (NSString *key in [modelClass propertyKeys]) {
SEL selector = MTLSelectorWithKeyPattern(key, "JSONTransformer");
if ([modelClass respondsToSelector:selector]) {
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[modelClass methodSignatureForSelector:selector]];
invocation.target = modelClass;
invocation.selector = selector;
[invocation invoke];

__unsafe_unretained id transformer = nil;
[invocation getReturnValue:&transformer];
IMP imp = [modelClass methodForSelector:selector];
NSValueTransformer * (*function)(id, SEL) = (__typeof__(function))imp;
NSValueTransformer *transformer = function(modelClass, selector);

if (transformer != nil) result[key] = transformer;

Expand Down Expand Up @@ -448,14 +444,11 @@ + (NSValueTransformer *)transformerForModelPropertiesOfClass:(Class)modelClass {

SEL selector = MTLSelectorWithKeyPattern(NSStringFromClass(modelClass), "JSONTransformer");
if (![self respondsToSelector:selector]) return nil;

NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:selector]];
invocation.target = self;
invocation.selector = selector;
[invocation invoke];

__unsafe_unretained id result = nil;
[invocation getReturnValue:&result];

IMP imp = [self methodForSelector:selector];
NSValueTransformer * (*function)(id, SEL) = (__typeof__(function))imp;
NSValueTransformer *result = function(self, selector);

return result;
}

Expand Down
13 changes: 4 additions & 9 deletions Mantle/Mantle/MTLModel+NSCoding.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,10 @@ - (id)decodeValueForKey:(NSString *)key withCoder:(NSCoder *)coder modelVersion:

SEL selector = MTLSelectorWithCapitalizedKeyPattern("decode", key, "WithCoder:modelVersion:");
if ([self respondsToSelector:selector]) {
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:selector]];
invocation.target = self;
invocation.selector = selector;
[invocation setArgument:&coder atIndex:2];
[invocation setArgument:&modelVersion atIndex:3];
[invocation invoke];

__unsafe_unretained id result = nil;
[invocation getReturnValue:&result];
IMP imp = [self methodForSelector:selector];
id (*function)(id, SEL, NSCoder *, NSUInteger) = (__typeof__(function))imp;
id result = function(self, selector, coder, modelVersion);

return result;
}

Expand Down
9 changes: 3 additions & 6 deletions Mantle/Mantle/MTLModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,9 @@ - (void)mergeValueForKey:(NSString *)key fromModel:(NSObject<MTLModel> *)model {
return;
}

NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:selector]];
invocation.target = self;
invocation.selector = selector;

[invocation setArgument:&model atIndex:2];
[invocation invoke];
IMP imp = [self methodForSelector:selector];
void (*function)(id, SEL, id<MTLModel>) = (__typeof__(function))imp;
function(self, selector, model);
}

- (void)mergeValuesForKeysFromModel:(id<MTLModel>)model {
Expand Down
2 changes: 1 addition & 1 deletion Mantle/Mantle/NSDictionary+MTLMappingAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
///
/// Returns a dictionary that maps all properties of the given class to
/// themselves.
+ (NSDictionary *)mtl_identityPropertyMapWithModel:(Class)class;
+ (NSDictionary *)mtl_identityPropertyMapWithModel:(Class)modelClass;

@end
6 changes: 3 additions & 3 deletions Mantle/Mantle/NSDictionary+MTLMappingAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

@implementation NSDictionary (MTLMappingAdditions)

+ (NSDictionary *)mtl_identityPropertyMapWithModel:(Class)class {
NSCParameterAssert([class isSubclassOfClass:MTLModel.class]);
+ (NSDictionary *)mtl_identityPropertyMapWithModel:(Class)modelClass {
NSCParameterAssert([modelClass isSubclassOfClass:MTLModel.class]);

NSArray *propertyKeys = [class propertyKeys].allObjects;
NSArray *propertyKeys = [modelClass propertyKeys].allObjects;

return [NSDictionary dictionaryWithObjects:propertyKeys forKeys:propertyKeys];
}
Expand Down
2 changes: 1 addition & 1 deletion Mantle/Mantle/NSError+MTLModelException.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@interface NSError (MTLModelException)

/// Creates a new error for an exception that occured during updating an
/// Creates a new error for an exception that occurred during updating an
/// MTLModel.
///
/// exception - The exception that was thrown while updating the model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extern NSString * const MTLBooleanValueTransformerName;
///
/// Returns a transformer which will return an error if the transformed in value
/// is not a member of class. Otherwise, the value is simply passed through.
+ (NSValueTransformer<MTLTransformerErrorHandling> *)mtl_validatingTransformerForClass:(Class)class;
+ (NSValueTransformer<MTLTransformerErrorHandling> *)mtl_validatingTransformerForClass:(Class)modelClass;

+ (NSValueTransformer<MTLTransformerErrorHandling> *)mtl_JSONDictionaryTransformerWithModelClass:(Class)modelClass __attribute__((deprecated("Replaced by +[MTLJSONAdapter dictionaryTransformerWithModelClass:]")));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,17 @@ + (void)load {
}
}

+ (NSValueTransformer<MTLTransformerErrorHandling> *)mtl_validatingTransformerForClass:(Class)class {
NSParameterAssert(class != nil);
+ (NSValueTransformer<MTLTransformerErrorHandling> *)mtl_validatingTransformerForClass:(Class)modelClass {
NSParameterAssert(modelClass != nil);

return [MTLValueTransformer transformerUsingForwardBlock:^ id (id value, BOOL *success, NSError **error) {
if (value != nil && ![value isKindOfClass:class]) {
if (value != nil && ![value isKindOfClass:modelClass]) {
if (error != NULL) {
NSDictionary *userInfo = @{
NSLocalizedDescriptionKey: NSLocalizedString(@"Value did not match expected type", @""),
NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:NSLocalizedString(@"Expected %1$@ to be of class %2$@", @""), value, class],
MTLTransformerErrorHandlingInputValueErrorKey : value
};
NSLocalizedDescriptionKey: NSLocalizedString(@"Value did not match expected type", @""),
NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:NSLocalizedString(@"Expected %1$@ to be of class %2$@ but got %3$@", @""), value, modelClass, [value class]],
MTLTransformerErrorHandlingInputValueErrorKey : value
};

*error = [NSError errorWithDomain:MTLTransformerErrorHandlingErrorDomain code:MTLTransformerErrorHandlingErrorInvalidInput userInfo:userInfo];
}
Expand Down
24 changes: 8 additions & 16 deletions Mantle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,29 +470,21 @@ in memory at once, Core Data may be a better choice.

## System Requirements

Mantle supports OS X 10.7+ and iOS 5.0+.
Mantle supports OS X 10.9+ and iOS 8.0+.

## Importing Mantle

To add Mantle to your application:

1. Add the Mantle repository as a submodule of your application's repository.
1. Run `script/bootstrap` from within the Mantle folder.
1. Drag and drop `Mantle.xcodeproj` into your application's Xcode project or
workspace.
1. On the "Build Phases" tab of your application target, add Mantle to the
"Link Binary With Libraries" phase.
* **On iOS**, add `libMantle.a`.
* **On OS X**, add `Mantle.framework`. Mantle must also be added to any
"Copy Frameworks" build phase. If you don't already have one, simply add a
"Copy Files" build phase and target the "Frameworks" destination.
1. Add `"$(BUILD_ROOT)/../IntermediateBuildFilesPath/UninstalledProducts/include" $(inherited)`
to the "Header Search Paths" build setting (this is only
necessary for archive builds, but it has no negative effect otherwise).
1. **For iOS targets**, add `-ObjC` to the "Other Linker Flags" build setting.
1. **If you added Mantle to a project (not a workspace)**, you will also need
to add the appropriate Mantle target to the "Target Dependencies" of your
application.
1. Drag and drop `Mantle.xcodeproj` into your application's Xcode project. Unfortunately, an [Xcode bug](http://www.openradar.appspot.com/19676555) means you should probably not add it to a workspace.
1. On the "General" tab of your application target, add `Mantle.framework` to the "Embedded Binaries".

[Carthage](https://github.com/Carthage/Carthage) users can simply add Mantle to their `Cartfile`:
```
github "Mantle/Mantle"
```

If you would prefer to use [CocoaPods](http://cocoapods.org), there are some
[Mantle podspecs](https://github.com/CocoaPods/Specs/tree/master/Specs/Mantle) that
Expand Down
Loading

0 comments on commit 41c8315

Please sign in to comment.