Skip to content

Commit 1ff6c8b

Browse files
committed
Merge pull request #49 from gonzalezreal/swift_2
Xcode 7 and Swift 2 support
2 parents c69c501 + 87c4d5f commit 1ff6c8b

File tree

13 files changed

+146
-106
lines changed

13 files changed

+146
-106
lines changed

Groot.xcodeproj/project.pbxproj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,9 @@
465465
B4DC1AE31AA9CA5E00F67403 /* Project object */ = {
466466
isa = PBXProject;
467467
attributes = {
468-
LastUpgradeCheck = 0610;
468+
LastSwiftMigration = 0700;
469+
LastSwiftUpdateCheck = 0700;
470+
LastUpgradeCheck = 0700;
469471
ORGANIZATIONNAME = "Guillermo Gonzalez";
470472
TargetAttributes = {
471473
B40873611B5AB6930063F150 = {
@@ -653,6 +655,7 @@
653655
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
654656
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
655657
MACOSX_DEPLOYMENT_TARGET = 10.9;
658+
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
656659
PRODUCT_NAME = Groot;
657660
SDKROOT = macosx;
658661
SKIP_INSTALL = YES;
@@ -675,6 +678,7 @@
675678
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
676679
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
677680
MACOSX_DEPLOYMENT_TARGET = 10.9;
681+
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
678682
PRODUCT_NAME = Groot;
679683
SDKROOT = macosx;
680684
SKIP_INSTALL = YES;
@@ -698,6 +702,7 @@
698702
INFOPLIST_FILE = GrootTests/Info.plist;
699703
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
700704
MACOSX_DEPLOYMENT_TARGET = 10.10;
705+
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
701706
PRODUCT_NAME = GrootTests;
702707
SDKROOT = macosx;
703708
};
@@ -717,6 +722,7 @@
717722
INFOPLIST_FILE = GrootTests/Info.plist;
718723
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
719724
MACOSX_DEPLOYMENT_TARGET = 10.10;
725+
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
720726
PRODUCT_NAME = GrootTests;
721727
SDKROOT = macosx;
722728
};
@@ -743,6 +749,7 @@
743749
COPY_PHASE_STRIP = NO;
744750
CURRENT_PROJECT_VERSION = 1;
745751
ENABLE_STRICT_OBJC_MSGSEND = YES;
752+
ENABLE_TESTABILITY = YES;
746753
GCC_C_LANGUAGE_STANDARD = gnu99;
747754
GCC_DYNAMIC_NO_PIC = NO;
748755
GCC_OPTIMIZATION_LEVEL = 0;
@@ -817,6 +824,7 @@
817824
INFOPLIST_FILE = Groot/Info.plist;
818825
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
819826
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
827+
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
820828
PRODUCT_NAME = "$(TARGET_NAME)";
821829
SKIP_INSTALL = YES;
822830
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -835,6 +843,7 @@
835843
INFOPLIST_FILE = Groot/Info.plist;
836844
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
837845
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
846+
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
838847
PRODUCT_NAME = "$(TARGET_NAME)";
839848
SKIP_INSTALL = YES;
840849
TARGETED_DEVICE_FAMILY = "1,2";
@@ -855,6 +864,7 @@
855864
);
856865
INFOPLIST_FILE = GrootTests/Info.plist;
857866
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
867+
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
858868
PRODUCT_NAME = "$(TARGET_NAME)";
859869
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
860870
};
@@ -870,6 +880,7 @@
870880
);
871881
INFOPLIST_FILE = GrootTests/Info.plist;
872882
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
883+
PRODUCT_BUNDLE_IDENTIFIER = "com.gonzalezreal.$(PRODUCT_NAME:rfc1034identifier)";
873884
PRODUCT_NAME = "$(TARGET_NAME)";
874885
};
875886
name = Release;

Groot.xcodeproj/xcshareddata/xcschemes/Groot-Mac.xcscheme

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0640"
3+
LastUpgradeVersion = "0700"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -37,10 +37,10 @@
3737
</BuildActionEntries>
3838
</BuildAction>
3939
<TestAction
40+
buildConfiguration = "Debug"
4041
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4142
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
42-
shouldUseLaunchSchemeArgsEnv = "YES"
43-
buildConfiguration = "Debug">
43+
shouldUseLaunchSchemeArgsEnv = "YES">
4444
<Testables>
4545
<TestableReference
4646
skipped = "NO">
@@ -62,15 +62,18 @@
6262
ReferencedContainer = "container:Groot.xcodeproj">
6363
</BuildableReference>
6464
</MacroExpansion>
65+
<AdditionalOptions>
66+
</AdditionalOptions>
6567
</TestAction>
6668
<LaunchAction
69+
buildConfiguration = "Debug"
6770
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
6871
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
6972
launchStyle = "0"
7073
useCustomWorkingDirectory = "NO"
71-
buildConfiguration = "Debug"
7274
ignoresPersistentStateOnLaunch = "NO"
7375
debugDocumentVersioning = "YES"
76+
debugServiceExtension = "internal"
7477
allowLocationSimulation = "YES">
7578
<MacroExpansion>
7679
<BuildableReference
@@ -85,10 +88,10 @@
8588
</AdditionalOptions>
8689
</LaunchAction>
8790
<ProfileAction
91+
buildConfiguration = "Release"
8892
shouldUseLaunchSchemeArgsEnv = "YES"
8993
savedToolIdentifier = ""
9094
useCustomWorkingDirectory = "NO"
91-
buildConfiguration = "Release"
9295
debugDocumentVersioning = "YES">
9396
<MacroExpansion>
9497
<BuildableReference

Groot.xcodeproj/xcshareddata/xcschemes/Groot.xcscheme

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0610"
3+
LastUpgradeVersion = "0700"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -37,10 +37,10 @@
3737
</BuildActionEntries>
3838
</BuildAction>
3939
<TestAction
40+
buildConfiguration = "Debug"
4041
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4142
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
42-
shouldUseLaunchSchemeArgsEnv = "YES"
43-
buildConfiguration = "Debug">
43+
shouldUseLaunchSchemeArgsEnv = "YES">
4444
<Testables>
4545
<TestableReference
4646
skipped = "NO">
@@ -62,15 +62,18 @@
6262
ReferencedContainer = "container:Groot.xcodeproj">
6363
</BuildableReference>
6464
</MacroExpansion>
65+
<AdditionalOptions>
66+
</AdditionalOptions>
6567
</TestAction>
6668
<LaunchAction
69+
buildConfiguration = "Debug"
6770
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
6871
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
6972
launchStyle = "0"
7073
useCustomWorkingDirectory = "NO"
71-
buildConfiguration = "Debug"
7274
ignoresPersistentStateOnLaunch = "NO"
7375
debugDocumentVersioning = "YES"
76+
debugServiceExtension = "internal"
7477
allowLocationSimulation = "YES">
7578
<MacroExpansion>
7679
<BuildableReference
@@ -85,10 +88,10 @@
8588
</AdditionalOptions>
8689
</LaunchAction>
8790
<ProfileAction
91+
buildConfiguration = "Release"
8892
shouldUseLaunchSchemeArgsEnv = "YES"
8993
savedToolIdentifier = ""
9094
useCustomWorkingDirectory = "NO"
91-
buildConfiguration = "Release"
9295
debugDocumentVersioning = "YES">
9396
<MacroExpansion>
9497
<BuildableReference

Groot/GRTJSONSerialization.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ NS_ASSUME_NONNULL_BEGIN
3939
4040
@return An array of managed objects, or `nil` if an error occurs.
4141
*/
42-
+ (nullable NSArray *)objectsWithEntityName:(NSString *)entityName
43-
fromJSONData:(NSData *)data
44-
inContext:(NSManagedObjectContext *)context
45-
error:(NSError * __nullable * __nullable)error;
42+
+ (nullable NSArray<__kindof NSManagedObject *> *)objectsWithEntityName:(NSString *)entityName
43+
fromJSONData:(NSData *)data
44+
inContext:(NSManagedObjectContext *)context
45+
error:(NSError * __nullable * __nullable)error;
4646

4747
/**
4848
Creates or updates a managed object from a JSON dictionary.
@@ -57,10 +57,10 @@ NS_ASSUME_NONNULL_BEGIN
5757
5858
@return A managed object, or `nil` if an error occurs.
5959
*/
60-
+ (nullable id)objectWithEntityName:(NSString *)entityName
61-
fromJSONDictionary:(NSDictionary *)JSONDictionary
62-
inContext:(NSManagedObjectContext *)context
63-
error:(NSError * __nullable * __nullable)error;
60+
+ (nullable __kindof NSManagedObject *)objectWithEntityName:(NSString *)entityName
61+
fromJSONDictionary:(NSDictionary *)JSONDictionary
62+
inContext:(NSManagedObjectContext *)context
63+
error:(NSError * __nullable * __nullable)error;
6464

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

8181
/**
8282
Converts a managed object into a JSON representation.

Groot/GRTJSONSerialization.m

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030

3131
@implementation GRTJSONSerialization
3232

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

58-
+ (nullable id)objectWithEntityName:(NSString *)entityName
59-
fromJSONDictionary:(NSDictionary *)JSONDictionary
60-
inContext:(NSManagedObjectContext *)context
61-
error:(NSError *__autoreleasing __nullable * __nullable)outError
58+
+ (nullable __kindof NSManagedObject *)objectWithEntityName:(NSString *)entityName
59+
fromJSONDictionary:(NSDictionary *)JSONDictionary
60+
inContext:(NSManagedObjectContext *)context
61+
error:(NSError *__autoreleasing __nullable * __nullable)outError
6262
{
6363
NSError *error = nil;
6464
NSEntityDescription *entity = [NSEntityDescription grt_entityForName:entityName inContext:context error:&error];
@@ -75,10 +75,10 @@ + (nullable id)objectWithEntityName:(NSString *)entityName
7575
error:outError].firstObject;
7676
}
7777

78-
+ (nullable NSArray *)objectsWithEntityName:(NSString *)entityName
79-
fromJSONArray:(NSArray *)JSONArray
80-
inContext:(NSManagedObjectContext *)context
81-
error:(NSError *__autoreleasing __nullable * __nullable)outError
78+
+ (nullable NSArray<__kindof NSManagedObject *> *)objectsWithEntityName:(NSString *)entityName
79+
fromJSONArray:(NSArray *)JSONArray
80+
inContext:(NSManagedObjectContext *)context
81+
error:(NSError *__autoreleasing __nullable * __nullable)outError
8282
{
8383
NSError *error = nil;
8484
NSEntityDescription *entity = [NSEntityDescription grt_entityForName:entityName inContext:context error:&error];

Groot/GRTManagedStore.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ - (NSURL *)URL {
6060
return store.URL;
6161
}
6262

63+
- (instancetype)init {
64+
return [self initWithURL:nil model:[NSManagedObjectModel mergedModelFromBundles:nil] error:NULL];
65+
}
66+
6367
- (nullable instancetype)initWithURL:(nullable NSURL *)URL
6468
model:(NSManagedObjectModel *)managedObjectModel
6569
error:(NSError *__autoreleasing __nullable * __nullable)outError

0 commit comments

Comments
 (0)