Compare commits
8 Commits
master
...
1.x-mainte
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78d3966b3c | ||
|
|
1557750fc8 | ||
|
|
65b8974dac | ||
|
|
92b1b7c24b | ||
|
|
1c26197186 | ||
|
|
73264d45c7 | ||
|
|
e41221ee94 | ||
|
|
b36f6acc2e |
@ -1,3 +1,3 @@
|
||||
github "jspahrsummers/xcconfigs" >= 0.7.1
|
||||
github "jspahrsummers/xcconfigs" >= 0.8
|
||||
github "Quick/Quick" ~> 0.2
|
||||
github "Quick/Nimble" ~> 0.2
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
github "Quick/Nimble" "v0.2.0"
|
||||
github "Quick/Quick" "v0.2.2"
|
||||
github "jspahrsummers/xcconfigs" "0.7.1"
|
||||
github "Quick/Quick" "v0.2.3"
|
||||
github "jspahrsummers/xcconfigs" "0.8.1"
|
||||
|
||||
2
Carthage/Checkouts/Quick
vendored
2
Carthage/Checkouts/Quick
vendored
@ -1 +1 @@
|
||||
Subproject commit b0e98286db7e9d1f1e73cd4e69eac2aae2a1e3f8
|
||||
Subproject commit ce729620fa9db8d3c76b69bbfc429cece97dbe36
|
||||
2
Carthage/Checkouts/xcconfigs
vendored
2
Carthage/Checkouts/xcconfigs
vendored
@ -1 +1 @@
|
||||
Subproject commit b09b4b63235b760a3a48a8dd19c0415aaaa8f269
|
||||
Subproject commit 99624a6af366c015b678a1135e4c558776a59be6
|
||||
@ -39,8 +39,8 @@
|
||||
D08B5AAE16002694001FE685 /* MTLValueTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = D08B5AAC16002694001FE685 /* MTLValueTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D08B5AAF16002694001FE685 /* MTLValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = D08B5AAD16002694001FE685 /* MTLValueTransformer.m */; };
|
||||
D08B5AB216002A23001FE685 /* MTLValueTransformerSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D08B5AB116002A23001FE685 /* MTLValueTransformerSpec.m */; };
|
||||
D094E47B1777617500906BF7 /* EXTRuntimeExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = D094E4771777617300906BF7 /* EXTRuntimeExtensions.m */; };
|
||||
D094E47D1777617800906BF7 /* EXTScope.m in Sources */ = {isa = PBXBuildFile; fileRef = D094E4791777617300906BF7 /* EXTScope.m */; };
|
||||
D094E47B1777617500906BF7 /* MTLEXTRuntimeExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = D094E4771777617300906BF7 /* MTLEXTRuntimeExtensions.m */; };
|
||||
D094E47D1777617800906BF7 /* MTLEXTScope.m in Sources */ = {isa = PBXBuildFile; fileRef = D094E4791777617300906BF7 /* MTLEXTScope.m */; };
|
||||
D0ABD7A11746D56E006BEA7D /* MTLManagedObjectAdapterSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D0ABD7A01746D56E006BEA7D /* MTLManagedObjectAdapterSpec.m */; };
|
||||
D0BFC36717476A5F00F5DC5D /* MTLValueTransformerInversionAdditionsSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D0BFC36617476A5F00F5DC5D /* MTLValueTransformerInversionAdditionsSpec.m */; };
|
||||
D0BFC36F17476B4700F5DC5D /* NSValueTransformer+MTLInversionAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D0BFC36D17476B4700F5DC5D /* NSValueTransformer+MTLInversionAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@ -74,8 +74,8 @@
|
||||
D0E9C38C19F6DC5B000D427D /* NSValueTransformer+MTLInversionAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D0BFC36E17476B4700F5DC5D /* NSValueTransformer+MTLInversionAdditions.m */; };
|
||||
D0E9C38D19F6DC5B000D427D /* NSValueTransformer+MTLPredefinedTransformerAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D0F117471614C5600092520B /* NSValueTransformer+MTLPredefinedTransformerAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D0E9C38E19F6DC5B000D427D /* NSValueTransformer+MTLPredefinedTransformerAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F117481614C5600092520B /* NSValueTransformer+MTLPredefinedTransformerAdditions.m */; };
|
||||
D0E9C38F19F6DC83000D427D /* EXTRuntimeExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = D094E4771777617300906BF7 /* EXTRuntimeExtensions.m */; };
|
||||
D0E9C39019F6DC87000D427D /* EXTScope.m in Sources */ = {isa = PBXBuildFile; fileRef = D094E4791777617300906BF7 /* EXTScope.m */; };
|
||||
D0E9C38F19F6DC83000D427D /* MTLEXTRuntimeExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = D094E4771777617300906BF7 /* MTLEXTRuntimeExtensions.m */; };
|
||||
D0E9C39019F6DC87000D427D /* MTLEXTScope.m in Sources */ = {isa = PBXBuildFile; fileRef = D094E4791777617300906BF7 /* MTLEXTScope.m */; };
|
||||
D0E9C39519F6DFD9000D427D /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0E9C39419F6DFD9000D427D /* Quick.framework */; };
|
||||
D0E9C39919F6E008000D427D /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0E9C39819F6E008000D427D /* Nimble.framework */; };
|
||||
D0E9C39A19F6E00F000D427D /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0E9C39819F6E008000D427D /* Nimble.framework */; };
|
||||
@ -179,11 +179,11 @@
|
||||
D08B5AAC16002694001FE685 /* MTLValueTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTLValueTransformer.h; sourceTree = "<group>"; };
|
||||
D08B5AAD16002694001FE685 /* MTLValueTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTLValueTransformer.m; sourceTree = "<group>"; };
|
||||
D08B5AB116002A23001FE685 /* MTLValueTransformerSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTLValueTransformerSpec.m; sourceTree = "<group>"; };
|
||||
D094E4751777617300906BF7 /* EXTKeyPathCoding.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EXTKeyPathCoding.h; sourceTree = "<group>"; };
|
||||
D094E4761777617300906BF7 /* EXTRuntimeExtensions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EXTRuntimeExtensions.h; sourceTree = "<group>"; };
|
||||
D094E4771777617300906BF7 /* EXTRuntimeExtensions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EXTRuntimeExtensions.m; sourceTree = "<group>"; };
|
||||
D094E4781777617300906BF7 /* EXTScope.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EXTScope.h; sourceTree = "<group>"; };
|
||||
D094E4791777617300906BF7 /* EXTScope.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EXTScope.m; sourceTree = "<group>"; };
|
||||
D094E4751777617300906BF7 /* MTLEXTKeyPathCoding.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTLEXTKeyPathCoding.h; sourceTree = "<group>"; };
|
||||
D094E4761777617300906BF7 /* MTLEXTRuntimeExtensions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTLEXTRuntimeExtensions.h; sourceTree = "<group>"; };
|
||||
D094E4771777617300906BF7 /* MTLEXTRuntimeExtensions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MTLEXTRuntimeExtensions.m; sourceTree = "<group>"; };
|
||||
D094E4781777617300906BF7 /* MTLEXTScope.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTLEXTScope.h; sourceTree = "<group>"; };
|
||||
D094E4791777617300906BF7 /* MTLEXTScope.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MTLEXTScope.m; sourceTree = "<group>"; };
|
||||
D094E47A1777617300906BF7 /* metamacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = metamacros.h; sourceTree = "<group>"; };
|
||||
D094E4811777619600906BF7 /* Common.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = "<group>"; };
|
||||
D094E4831777619600906BF7 /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
|
||||
@ -430,11 +430,11 @@
|
||||
D090E63A15F73249005282F9 /* libextobjc */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D094E4751777617300906BF7 /* EXTKeyPathCoding.h */,
|
||||
D094E4761777617300906BF7 /* EXTRuntimeExtensions.h */,
|
||||
D094E4771777617300906BF7 /* EXTRuntimeExtensions.m */,
|
||||
D094E4781777617300906BF7 /* EXTScope.h */,
|
||||
D094E4791777617300906BF7 /* EXTScope.m */,
|
||||
D094E4751777617300906BF7 /* MTLEXTKeyPathCoding.h */,
|
||||
D094E4761777617300906BF7 /* MTLEXTRuntimeExtensions.h */,
|
||||
D094E4771777617300906BF7 /* MTLEXTRuntimeExtensions.m */,
|
||||
D094E4781777617300906BF7 /* MTLEXTScope.h */,
|
||||
D094E4791777617300906BF7 /* MTLEXTScope.m */,
|
||||
D094E47A1777617300906BF7 /* metamacros.h */,
|
||||
);
|
||||
name = libextobjc;
|
||||
@ -720,8 +720,8 @@
|
||||
D058FE2116EFB3D2009DFB47 /* MTLReflection.m in Sources */,
|
||||
D0E51939170A06CF00E8897B /* MTLManagedObjectAdapter.m in Sources */,
|
||||
D0BFC37117476B4700F5DC5D /* NSValueTransformer+MTLInversionAdditions.m in Sources */,
|
||||
D094E47B1777617500906BF7 /* EXTRuntimeExtensions.m in Sources */,
|
||||
D094E47D1777617800906BF7 /* EXTScope.m in Sources */,
|
||||
D094E47B1777617500906BF7 /* MTLEXTRuntimeExtensions.m in Sources */,
|
||||
D094E47D1777617800906BF7 /* MTLEXTScope.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -765,8 +765,8 @@
|
||||
D0E9C38819F6DC5B000D427D /* NSDictionary+MTLManipulationAdditions.m in Sources */,
|
||||
D0E9C38219F6DC5B000D427D /* MTLValueTransformer.m in Sources */,
|
||||
D0E9C38C19F6DC5B000D427D /* NSValueTransformer+MTLInversionAdditions.m in Sources */,
|
||||
D0E9C38F19F6DC83000D427D /* EXTRuntimeExtensions.m in Sources */,
|
||||
D0E9C39019F6DC87000D427D /* EXTScope.m in Sources */,
|
||||
D0E9C38F19F6DC83000D427D /* MTLEXTRuntimeExtensions.m in Sources */,
|
||||
D0E9C39019F6DC87000D427D /* MTLEXTScope.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
buildConfiguration = "Release">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
|
||||
@ -275,14 +275,10 @@ static NSString * const MTLJSONAdapterThrownExceptionErrorKey = @"MTLJSONAdapter
|
||||
|
||||
SEL selector = MTLSelectorWithKeyPattern(key, "JSONTransformer");
|
||||
if ([self.modelClass respondsToSelector:selector]) {
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[self.modelClass methodSignatureForSelector:selector]];
|
||||
invocation.target = self.modelClass;
|
||||
invocation.selector = selector;
|
||||
[invocation invoke];
|
||||
|
||||
__unsafe_unretained id result = nil;
|
||||
[invocation getReturnValue:&result];
|
||||
return result;
|
||||
IMP imp = [self.modelClass methodForSelector:selector];
|
||||
NSValueTransformer * (*function)(id, SEL) = (__typeof__(function))imp;
|
||||
NSValueTransformer *transformer = function(self.modelClass, selector);
|
||||
return transformer;
|
||||
}
|
||||
|
||||
if ([self.modelClass respondsToSelector:@selector(JSONTransformerForKey:)]) {
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
//
|
||||
|
||||
#import "MTLManagedObjectAdapter.h"
|
||||
#import "EXTScope.h"
|
||||
#import "MTLEXTScope.h"
|
||||
#import "MTLModel.h"
|
||||
#import "MTLReflection.h"
|
||||
#import "NSArray+MTLManipulationAdditions.h"
|
||||
@ -571,14 +571,10 @@ static id performInContext(NSManagedObjectContext *context, id (^block)(void)) {
|
||||
|
||||
SEL selector = MTLSelectorWithKeyPattern(key, "EntityAttributeTransformer");
|
||||
if ([self.modelClass respondsToSelector:selector]) {
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[self.modelClass methodSignatureForSelector:selector]];
|
||||
invocation.target = self.modelClass;
|
||||
invocation.selector = selector;
|
||||
[invocation invoke];
|
||||
|
||||
__unsafe_unretained id result = nil;
|
||||
[invocation getReturnValue:&result];
|
||||
return result;
|
||||
IMP imp = [self.modelClass methodForSelector:selector];
|
||||
NSValueTransformer * (*function)(id, SEL) = (__typeof__(function))imp;
|
||||
NSValueTransformer *transformer = function(self.modelClass, selector);
|
||||
return transformer;
|
||||
}
|
||||
|
||||
if ([self.modelClass respondsToSelector:@selector(entityAttributeTransformerForKey:)]) {
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
//
|
||||
|
||||
#import "MTLModel+NSCoding.h"
|
||||
#import "EXTRuntimeExtensions.h"
|
||||
#import "EXTScope.h"
|
||||
#import "MTLEXTRuntimeExtensions.h"
|
||||
#import "MTLEXTScope.h"
|
||||
#import "MTLReflection.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
@ -129,15 +129,10 @@ static void verifyAllowedClassesByPropertyKey(Class modelClass) {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
|
||||
#import "NSError+MTLModelException.h"
|
||||
#import "MTLModel.h"
|
||||
#import "EXTRuntimeExtensions.h"
|
||||
#import "EXTScope.h"
|
||||
#import "MTLEXTRuntimeExtensions.h"
|
||||
#import "MTLEXTScope.h"
|
||||
#import "MTLReflection.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
@ -175,12 +175,9 @@ static BOOL MTLValidateAndSetValue(id obj, NSString *key, id value, BOOL forceUp
|
||||
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, MTLModel *) = (__typeof__(function))imp;
|
||||
function(self, selector, model);
|
||||
}
|
||||
|
||||
- (void)mergeValuesForKeysFromModel:(MTLModel *)model {
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
// Released under the MIT license.
|
||||
//
|
||||
|
||||
#import "EXTRuntimeExtensions.h"
|
||||
#import "MTLEXTRuntimeExtensions.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
// Released under the MIT license.
|
||||
//
|
||||
|
||||
#import "EXTScope.h"
|
||||
#import "MTLEXTScope.h"
|
||||
|
||||
void mtl_executeCleanupBlock (__strong mtl_cleanupBlock_t *block) {
|
||||
(*block)();
|
||||
@ -12,6 +12,13 @@
|
||||
|
||||
#import "MTLTestModel.h"
|
||||
|
||||
@interface MTLJSONAdapter (SpecExtensions)
|
||||
|
||||
// Used for testing transformer lifetimes.
|
||||
- (NSValueTransformer *)JSONTransformerForKey:(NSString *)key;
|
||||
|
||||
@end
|
||||
|
||||
QuickSpecBegin(MTLJSONAdapterSpec)
|
||||
|
||||
it(@"should initialize from JSON", ^{
|
||||
@ -278,5 +285,20 @@ it(@"should return an array of dictionaries from models", ^{
|
||||
expect(JSONArray[1][@"username"]).to(equal(@"bar"));
|
||||
});
|
||||
|
||||
it(@"should not leak transformers", ^{
|
||||
MTLTestModel *model = [[MTLTestModel alloc] init];
|
||||
MTLJSONAdapter *adapter = [[MTLJSONAdapter alloc] initWithModel:model];
|
||||
|
||||
__weak id weakTransformer;
|
||||
|
||||
@autoreleasepool {
|
||||
id transformer = [adapter JSONTransformerForKey:@"count"];
|
||||
weakTransformer = transformer;
|
||||
|
||||
expect(transformer).notTo(beNil());
|
||||
}
|
||||
|
||||
expect(weakTransformer).toEventually(beNil());
|
||||
});
|
||||
|
||||
QuickSpecEnd
|
||||
|
||||
Loading…
Reference in New Issue
Block a user