Permalink
Browse files

Move MTLManagedObjectAdapter into the main project

As long as we don't ever reference Core Data classes directly, we should be able to use methods from them.
  • Loading branch information...
1 parent 4eed118 commit 0d0faa19801f1cef9e4245d1dbf900928ce66d06 @jspahrsummers jspahrsummers committed Apr 1, 2013
@@ -70,6 +70,10 @@
D0D46A0E160BC98600AB468D /* libSpecta.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D0D469EE160BC93E00AB468D /* libSpecta.a */; };
D0D46A13160BC98E00AB468D /* libExpecta-iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D0D469DF160BC93400AB468D /* libExpecta-iOS.a */; };
D0D46A14160BC98E00AB468D /* libSpecta-iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D0D469F0160BC93E00AB468D /* libSpecta-iOS.a */; };
+ D0E51937170A06CF00E8897B /* MTLManagedObjectAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = D0E51935170A06CF00E8897B /* MTLManagedObjectAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ D0E51938170A06CF00E8897B /* MTLManagedObjectAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = D0E51935170A06CF00E8897B /* MTLManagedObjectAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ D0E51939170A06CF00E8897B /* MTLManagedObjectAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E51936170A06CF00E8897B /* MTLManagedObjectAdapter.m */; };
+ D0E5193A170A06CF00E8897B /* MTLManagedObjectAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E51936170A06CF00E8897B /* MTLManagedObjectAdapter.m */; };
D0F117491614C5600092520B /* NSValueTransformer+MTLPredefinedTransformerAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D0F117471614C5600092520B /* NSValueTransformer+MTLPredefinedTransformerAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
D0F1174A1614C5600092520B /* NSValueTransformer+MTLPredefinedTransformerAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F117481614C5600092520B /* NSValueTransformer+MTLPredefinedTransformerAdditions.m */; };
D0F1174B1614C5600092520B /* NSValueTransformer+MTLPredefinedTransformerAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F117481614C5600092520B /* NSValueTransformer+MTLPredefinedTransformerAdditions.m */; };
@@ -230,8 +234,6 @@
D042FCEE15F72EF1004E8054 /* Specta.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Specta.xcodeproj; path = MantleTests/specta/Specta.xcodeproj; sourceTree = "<group>"; };
D058FE1D16EFB3D2009DFB47 /* MTLReflection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTLReflection.h; sourceTree = "<group>"; };
D058FE1E16EFB3D2009DFB47 /* MTLReflection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTLReflection.m; sourceTree = "<group>"; };
- D06331B0170581F000A67653 /* MTLManagedObjectAdapter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTLManagedObjectAdapter.h; sourceTree = "<group>"; };
- D06331B1170581F000A67653 /* MTLManagedObjectAdapter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MTLManagedObjectAdapter.m; sourceTree = "<group>"; };
D064BA321613BA75004CA27A /* MTLTestNotificationObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTLTestNotificationObserver.h; sourceTree = "<group>"; };
D064BA331613BA75004CA27A /* MTLTestNotificationObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTLTestNotificationObserver.m; sourceTree = "<group>"; };
D0760E7615FFBF330060F550 /* MTLModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTLModel.h; sourceTree = "<group>"; };
@@ -252,6 +254,8 @@
D0C92DE115F72F6A00387438 /* MantleTests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MantleTests-Prefix.pch"; sourceTree = "<group>"; };
D0CA6399162405170030AD06 /* EXTRuntimeExtensions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = EXTRuntimeExtensions.h; path = extobjc/EXTRuntimeExtensions.h; sourceTree = "<group>"; };
D0CA639A162405170030AD06 /* EXTRuntimeExtensions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = EXTRuntimeExtensions.m; path = extobjc/EXTRuntimeExtensions.m; sourceTree = "<group>"; };
+ D0E51935170A06CF00E8897B /* MTLManagedObjectAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTLManagedObjectAdapter.h; sourceTree = "<group>"; };
+ D0E51936170A06CF00E8897B /* MTLManagedObjectAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTLManagedObjectAdapter.m; sourceTree = "<group>"; };
D0F117471614C5600092520B /* NSValueTransformer+MTLPredefinedTransformerAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSValueTransformer+MTLPredefinedTransformerAdditions.h"; sourceTree = "<group>"; };
D0F117481614C5600092520B /* NSValueTransformer+MTLPredefinedTransformerAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSValueTransformer+MTLPredefinedTransformerAdditions.m"; sourceTree = "<group>"; };
D0F1174C1614C8000092520B /* MTLPredefinedTransformerAdditionsSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTLPredefinedTransformerAdditionsSpec.m; sourceTree = "<group>"; };
@@ -305,6 +309,8 @@
children = (
D01BD09B16CB432D00EC95C7 /* MTLJSONAdapter.h */,
D01BD09C16CB432D00EC95C7 /* MTLJSONAdapter.m */,
+ D0E51935170A06CF00E8897B /* MTLManagedObjectAdapter.h */,
+ D0E51936170A06CF00E8897B /* MTLManagedObjectAdapter.m */,
);
name = Adapters;
sourceTree = "<group>";
@@ -323,7 +329,6 @@
children = (
D042FC4515F72B23004E8054 /* Mantle */,
D042FC5B15F72B23004E8054 /* MantleTests */,
- D06331AB170581DE00A67653 /* MTLExtensions */,
D042FC3E15F72B23004E8054 /* Frameworks */,
D042FC9E15F72C16004E8054 /* Configuration */,
D042FC3D15F72B23004E8054 /* Products */,
@@ -461,15 +466,6 @@
path = "Mac OS X";
sourceTree = "<group>";
};
- D06331AB170581DE00A67653 /* MTLExtensions */ = {
- isa = PBXGroup;
- children = (
- D06331B0170581F000A67653 /* MTLManagedObjectAdapter.h */,
- D06331B1170581F000A67653 /* MTLManagedObjectAdapter.m */,
- );
- path = MTLExtensions;
- sourceTree = "<group>";
- };
D0760E7015FFBF020060F550 /* Modules */ = {
isa = PBXGroup;
children = (
@@ -566,6 +562,7 @@
1ED5B5D0163A4E3C0072668E /* NSObject+MTLComparisonAdditions.h in Headers */,
D01BD09D16CB432D00EC95C7 /* MTLJSONAdapter.h in Headers */,
D01BD0AF16CB52E800EC95C7 /* MTLModel+NSCoding.h in Headers */,
+ D0E51937170A06CF00E8897B /* MTLManagedObjectAdapter.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -582,6 +579,7 @@
D8A173031697E87A002CFCC8 /* NSObject+MTLComparisonAdditions.h in Headers */,
D01BD09E16CB432D00EC95C7 /* MTLJSONAdapter.h in Headers */,
D01BD0B016CB52E800EC95C7 /* MTLModel+NSCoding.h in Headers */,
+ D0E51938170A06CF00E8897B /* MTLManagedObjectAdapter.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -836,6 +834,7 @@
D01BD09F16CB432D00EC95C7 /* MTLJSONAdapter.m in Sources */,
D01BD0B116CB52E800EC95C7 /* MTLModel+NSCoding.m in Sources */,
D058FE2116EFB3D2009DFB47 /* MTLReflection.m in Sources */,
+ D0E51939170A06CF00E8897B /* MTLManagedObjectAdapter.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -871,6 +870,7 @@
D01BD0A016CB432D00EC95C7 /* MTLJSONAdapter.m in Sources */,
D01BD0B216CB52E800EC95C7 /* MTLModel+NSCoding.m in Sources */,
D058FE2216EFB3D2009DFB47 /* MTLReflection.m in Sources */,
+ D0E5193A170A06CF00E8897B /* MTLManagedObjectAdapter.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -7,14 +7,21 @@
//
#import "MTLManagedObjectAdapter.h"
+#import "MTLModel.h"
@implementation MTLManagedObjectAdapter
+ (id)modelOfClass:(Class)modelClass fromManagedObject:(NSManagedObject *)managedObject error:(NSError **)error {
+ Class managedObjectClass = NSClassFromString(@"NSManagedObject");
+ NSAssert(managedObjectClass != nil, @"CoreData.framework must be linked to use MTLManagedObjectAdapter");
+
return nil;
}
+ (NSManagedObject *)managedObjectFromModel:(MTLModel<MTLManagedObjectSerializing> *)model insertingIntoContext:(NSManagedObjectContext *)context error:(NSError **)error {
+ Class managedObjectClass = NSClassFromString(@"NSManagedObject");
+ NSAssert(managedObjectClass != nil, @"CoreData.framework must be linked to use MTLManagedObjectAdapter");
+
return nil;
}
View
@@ -7,6 +7,7 @@
//
#import <Mantle/MTLJSONAdapter.h>
+#import <Mantle/MTLManagedObjectAdapter.h>
#import <Mantle/MTLModel.h>
#import <Mantle/MTLModel+NSCoding.h>
#import <Mantle/MTLValueTransformer.h>

0 comments on commit 0d0faa1

Please sign in to comment.