Skip to content

Commit

Permalink
Merge pull request #49 from gonzalezreal/swift_2
Browse files Browse the repository at this point in the history
Xcode 7 and Swift 2 support
  • Loading branch information
gonzalezreal committed Sep 13, 2015
2 parents c69c501 + 87c4d5f commit 1ff6c8b
Show file tree
Hide file tree
Showing 13 changed files with 146 additions and 106 deletions.
13 changes: 12 additions & 1 deletion Groot.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,9 @@
B4DC1AE31AA9CA5E00F67403 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = "Guillermo Gonzalez";
TargetAttributes = {
B40873611B5AB6930063F150 = {
Expand Down Expand Up @@ -653,6 +655,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.9;
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Groot;
SDKROOT = macosx;
SKIP_INSTALL = YES;
Expand All @@ -675,6 +678,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.9;
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Groot;
SDKROOT = macosx;
SKIP_INSTALL = YES;
Expand All @@ -698,6 +702,7 @@
INFOPLIST_FILE = GrootTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = GrootTests;
SDKROOT = macosx;
};
Expand All @@ -717,6 +722,7 @@
INFOPLIST_FILE = GrootTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = GrootTests;
SDKROOT = macosx;
};
Expand All @@ -743,6 +749,7 @@
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -817,6 +824,7 @@
INFOPLIST_FILE = Groot/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -835,6 +843,7 @@
INFOPLIST_FILE = Groot/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -855,6 +864,7 @@
);
INFOPLIST_FILE = GrootTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
Expand All @@ -870,6 +880,7 @@
);
INFOPLIST_FILE = GrootTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
Expand Down
13 changes: 8 additions & 5 deletions Groot.xcodeproj/xcshareddata/xcschemes/Groot-Mac.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0640"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -37,10 +37,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -62,15 +62,18 @@
ReferencedContainer = "container:Groot.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
Expand All @@ -85,10 +88,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
Expand Down
13 changes: 8 additions & 5 deletions Groot.xcodeproj/xcshareddata/xcschemes/Groot.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -37,10 +37,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -62,15 +62,18 @@
ReferencedContainer = "container:Groot.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
Expand All @@ -85,10 +88,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
Expand Down
24 changes: 12 additions & 12 deletions Groot/GRTJSONSerialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ NS_ASSUME_NONNULL_BEGIN
@return An array of managed objects, or `nil` if an error occurs.
*/
+ (nullable NSArray *)objectsWithEntityName:(NSString *)entityName
fromJSONData:(NSData *)data
inContext:(NSManagedObjectContext *)context
error:(NSError * __nullable * __nullable)error;
+ (nullable NSArray<__kindof NSManagedObject *> *)objectsWithEntityName:(NSString *)entityName
fromJSONData:(NSData *)data
inContext:(NSManagedObjectContext *)context
error:(NSError * __nullable * __nullable)error;

/**
Creates or updates a managed object from a JSON dictionary.
Expand All @@ -57,10 +57,10 @@ NS_ASSUME_NONNULL_BEGIN
@return A managed object, or `nil` if an error occurs.
*/
+ (nullable id)objectWithEntityName:(NSString *)entityName
fromJSONDictionary:(NSDictionary *)JSONDictionary
inContext:(NSManagedObjectContext *)context
error:(NSError * __nullable * __nullable)error;
+ (nullable __kindof NSManagedObject *)objectWithEntityName:(NSString *)entityName
fromJSONDictionary:(NSDictionary *)JSONDictionary
inContext:(NSManagedObjectContext *)context
error:(NSError * __nullable * __nullable)error;

/**
Creates or updates a set of managed objects from a JSON array.
Expand All @@ -73,10 +73,10 @@ NS_ASSUME_NONNULL_BEGIN
@return An array of managed objects, or `nil` if an error occurs.
*/
+ (nullable NSArray *)objectsWithEntityName:(NSString *)entityName
fromJSONArray:(NSArray *)JSONArray
inContext:(NSManagedObjectContext *)context
error:(NSError * __nullable * __nullable)error;
+ (nullable NSArray<__kindof NSManagedObject *> *)objectsWithEntityName:(NSString *)entityName
fromJSONArray:(NSArray *)JSONArray
inContext:(NSManagedObjectContext *)context
error:(NSError * __nullable * __nullable)error;

/**
Converts a managed object into a JSON representation.
Expand Down
24 changes: 12 additions & 12 deletions Groot/GRTJSONSerialization.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@

@implementation GRTJSONSerialization

+ (nullable NSArray *)objectsWithEntityName:(NSString *)entityName
fromJSONData:(NSData *)data
inContext:(NSManagedObjectContext *)context
error:(NSError *__autoreleasing __nullable * __nullable)outError
+ (nullable NSArray<__kindof NSManagedObject *> *)objectsWithEntityName:(NSString *)entityName
fromJSONData:(NSData *)data
inContext:(NSManagedObjectContext *)context
error:(NSError *__autoreleasing __nullable * __nullable)outError
{
NSError *error = nil;
id parsedJSON = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
Expand All @@ -55,10 +55,10 @@ + (nullable NSArray *)objectsWithEntityName:(NSString *)entityName
return [self objectsWithEntityName:entityName fromJSONArray:array inContext:context error:outError];
}

+ (nullable id)objectWithEntityName:(NSString *)entityName
fromJSONDictionary:(NSDictionary *)JSONDictionary
inContext:(NSManagedObjectContext *)context
error:(NSError *__autoreleasing __nullable * __nullable)outError
+ (nullable __kindof NSManagedObject *)objectWithEntityName:(NSString *)entityName
fromJSONDictionary:(NSDictionary *)JSONDictionary
inContext:(NSManagedObjectContext *)context
error:(NSError *__autoreleasing __nullable * __nullable)outError
{
NSError *error = nil;
NSEntityDescription *entity = [NSEntityDescription grt_entityForName:entityName inContext:context error:&error];
Expand All @@ -75,10 +75,10 @@ + (nullable id)objectWithEntityName:(NSString *)entityName
error:outError].firstObject;
}

+ (nullable NSArray *)objectsWithEntityName:(NSString *)entityName
fromJSONArray:(NSArray *)JSONArray
inContext:(NSManagedObjectContext *)context
error:(NSError *__autoreleasing __nullable * __nullable)outError
+ (nullable NSArray<__kindof NSManagedObject *> *)objectsWithEntityName:(NSString *)entityName
fromJSONArray:(NSArray *)JSONArray
inContext:(NSManagedObjectContext *)context
error:(NSError *__autoreleasing __nullable * __nullable)outError
{
NSError *error = nil;
NSEntityDescription *entity = [NSEntityDescription grt_entityForName:entityName inContext:context error:&error];
Expand Down
4 changes: 4 additions & 0 deletions Groot/GRTManagedStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ - (NSURL *)URL {
return store.URL;
}

- (instancetype)init {
return [self initWithURL:nil model:[NSManagedObjectModel mergedModelFromBundles:nil] error:NULL];
}

- (nullable instancetype)initWithURL:(nullable NSURL *)URL
model:(NSManagedObjectModel *)managedObjectModel
error:(NSError *__autoreleasing __nullable * __nullable)outError
Expand Down
Loading

0 comments on commit 1ff6c8b

Please sign in to comment.