Skip to content

Commit ecf66a4

Browse files
author
Christian Kienle
authored
Merge pull request #37 from ChristianKienle/develop
Develop
2 parents 717ecbf + 14e8533 commit ecf66a4

File tree

110 files changed

+3116
-5289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+3116
-5289
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Core Data Editor/Core Data Editor.xcodeproj/xcuserdata
2+
CDE-Workspace.xcworkspace/xcuserdata/*
13
# OS X
24
.DS_Store
35

.travis.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1+
osx_image: xcode8.2
12
language: objective-c
2-
osx_image: xcode8
3-
before_install:
4-
- brew update
5-
- if brew outdated | grep -qx xctool; then brew upgrade xctool; fi
6-
script: xcodebuild -workspace CDE-Workspace.xcworkspace -scheme CDETests test
3+
script: xcodebuild -verbose -scheme "Core Data Editor" -workspace CDE-Workspace.xcworkspace build

CDE-Workspace.xcworkspace/xcshareddata/xcschemes/CDETests.xcscheme

Lines changed: 9 additions & 28 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 = "0800"
3+
LastUpgradeVersion = "0810"
44
version = "2.0">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -32,22 +32,13 @@
3232
skipped = "NO">
3333
<BuildableReference
3434
BuildableIdentifier = "primary"
35-
BlueprintIdentifier = "AB7EF6AD1DB4028C0062DD0C"
36-
BuildableName = "CDETests.xctest"
37-
BlueprintName = "CDETests"
35+
BlueprintIdentifier = "ABBEA8C0176620E10024A9D2"
36+
BuildableName = "Core Data Editor Tests.xctest"
37+
BlueprintName = "Core Data Editor Tests"
3838
ReferencedContainer = "container:Core Data Editor/Core Data Editor.xcodeproj">
3939
</BuildableReference>
4040
</TestableReference>
4141
</Testables>
42-
<MacroExpansion>
43-
<BuildableReference
44-
BuildableIdentifier = "primary"
45-
BlueprintIdentifier = "ABBEA7D51765CB730024A9D2"
46-
BuildableName = "Core Data Editor.app"
47-
BlueprintName = "Core Data Editor"
48-
ReferencedContainer = "container:Core Data Editor/Core Data Editor.xcodeproj">
49-
</BuildableReference>
50-
</MacroExpansion>
5142
<AdditionalOptions>
5243
</AdditionalOptions>
5344
</TestAction>
@@ -62,16 +53,15 @@
6253
debugXPCServices = "NO"
6354
debugServiceExtension = "internal"
6455
allowLocationSimulation = "YES">
65-
<BuildableProductRunnable
66-
runnableDebuggingMode = "0">
56+
<MacroExpansion>
6757
<BuildableReference
6858
BuildableIdentifier = "primary"
69-
BlueprintIdentifier = "ABBEA7D51765CB730024A9D2"
70-
BuildableName = "Core Data Editor.app"
71-
BlueprintName = "Core Data Editor"
59+
BlueprintIdentifier = "ABBEA8C0176620E10024A9D2"
60+
BuildableName = "Core Data Editor Tests.xctest"
61+
BlueprintName = "Core Data Editor Tests"
7262
ReferencedContainer = "container:Core Data Editor/Core Data Editor.xcodeproj">
7363
</BuildableReference>
74-
</BuildableProductRunnable>
64+
</MacroExpansion>
7565
<AdditionalOptions>
7666
</AdditionalOptions>
7767
</LaunchAction>
@@ -81,15 +71,6 @@
8171
savedToolIdentifier = ""
8272
useCustomWorkingDirectory = "NO"
8373
debugDocumentVersioning = "YES">
84-
<MacroExpansion>
85-
<BuildableReference
86-
BuildableIdentifier = "primary"
87-
BlueprintIdentifier = "ABBEA8C0176620E10024A9D2"
88-
BuildableName = "Core Data Editor Tests.xctest"
89-
BlueprintName = "Core Data Editor Tests"
90-
ReferencedContainer = "container:Core Data Editor/Core Data Editor.xcodeproj">
91-
</BuildableReference>
92-
</MacroExpansion>
9374
</ProfileAction>
9475
<AnalyzeAction
9576
buildConfiguration = "Debug">

CDE-Workspace.xcworkspace/xcshareddata/xcschemes/Core Data Editor.xcscheme

Lines changed: 1 addition & 11 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 = "0800"
3+
LastUpgradeVersion = "0810"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -28,16 +28,6 @@
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<Testables>
31-
<TestableReference
32-
skipped = "NO">
33-
<BuildableReference
34-
BuildableIdentifier = "primary"
35-
BlueprintIdentifier = "AB7EF6AD1DB4028C0062DD0C"
36-
BuildableName = "CDETests.xctest"
37-
BlueprintName = "CDETests"
38-
ReferencedContainer = "container:Core Data Editor/Core Data Editor.xcodeproj">
39-
</BuildableReference>
40-
</TestableReference>
4131
</Testables>
4232
<MacroExpansion>
4333
<BuildableReference

CDE-Workspace.xcworkspace/xcshareddata/xcschemes/iOS Example.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0800"
3+
LastUpgradeVersion = "0810"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

CDEKit/CDEKit/NSEntityDescription+CDEAdditions.h

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,15 @@
33
@interface NSEntityDescription (CDEAdditions)
44

55
#pragma mark - Convenience
6-
- (NSArray *)supportedAttributes_cde;
7-
- (NSArray *)toManyRelationships_cde;
8-
- (NSDictionary *)toManyRelationshipsByName_cde;
9-
- (NSArray *)sortedToManyRelationshipNames_cde;
10-
- (NSArray *)sortedToManyRelationships_cde;
11-
- (NSArray *)sortedToOneRelationships_cde;
12-
- (NSArray *)sortedRelationships_cde;
13-
//@property (nonatomic, readonly) NSString *nameForDisplay_cde;
6+
- (NSArray<NSAttributeDescription*> *)supportedAttributes_cde;
7+
- (NSArray<NSRelationshipDescription*> *)toManyRelationships_cde;
8+
- (NSDictionary<NSString*, NSRelationshopDescription*>*)toManyRelationshipsByName_cde;
9+
- (NSArray<NSString*> *)sortedToManyRelationshipNames_cde;
10+
- (NSArray<NSRelationshipDescription*> *)sortedToManyRelationships_cde;
11+
- (NSArray<NSRelationshipDescription*> *)sortedToOneRelationships_cde;
12+
- (NSArray<NSRelationshipDescription*> *)sortedRelationships_cde;
1413
- (NSAttributeDescription *)attributeDescriptionForName_cde:(NSString *)attributeName;
1514

16-
#pragma mark - CSV
17-
//// returns an array of arrays
18-
//- (NSArray *)CSVValuesForEachManagedObjectInArray_cde:(NSArray *)objects;
19-
//
20-
//// This method filters out any non supported property names and also respects the sorting of propertyNames
21-
//- (NSArray *)CSVValuesForEachManagedObjectInArray:(NSArray *)objects forPropertyNames:(NSArray *)propertyNames includeHeaderValues_cde:(BOOL)includeHeaderValues;
22-
//- (NSArray *)supportedCSVAttributes_cde;
23-
2415
#pragma mark - UI
2516
- (UIImage *)icon_cde;
2617

CDEKit/CDEKit/NSEntityDescription+CDEAdditions.m

Lines changed: 64 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -4,151 +4,91 @@
44
@implementation NSEntityDescription (CDEAdditions)
55

66
#pragma mark - Convenience
7-
- (NSArray *)supportedAttributes_cde {
8-
NSMutableArray *result = [NSMutableArray new];
9-
for(NSAttributeDescription *attribute in [[self attributesByName] allValues]) {
10-
// Ignore transient properties
11-
if(attribute.isTransient) {
12-
continue;
13-
}
14-
if(!attribute.isSupportedAttribute_cde) {
15-
continue;
16-
}
17-
18-
[result addObject:attribute];
7+
- (NSArray<NSAttributeDescription*> *)supportedAttributes_cde {
8+
NSMutableArray *result = [NSMutableArray new];
9+
for(NSAttributeDescription *attribute in [[self attributesByName] allValues]) {
10+
// Ignore transient properties
11+
if(attribute.isTransient) {
12+
continue;
1913
}
20-
return result;
14+
if(!attribute.isSupportedAttribute_cde) {
15+
continue;
16+
}
17+
18+
[result addObject:attribute];
19+
}
20+
return result;
2121
}
2222

23-
- (NSArray *)toManyRelationships_cde {
24-
NSMutableArray *result = [NSMutableArray new];
25-
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(id key, NSRelationshipDescription *relation, BOOL *stop) {
26-
if(relation.isToMany == NO) {
27-
return;
28-
}
29-
[result addObject:relation];
30-
}];
31-
return result;
23+
- (NSArray<NSRelationshipDescription*> *)toManyRelationships_cde {
24+
NSMutableArray *result = [NSMutableArray new];
25+
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(id key, NSRelationshipDescription *relation, BOOL *stop) {
26+
if(relation.isToMany == NO) {
27+
return;
28+
}
29+
[result addObject:relation];
30+
}];
31+
return result;
3232
}
3333

34-
- (NSDictionary *)toManyRelationshipsByName_cde {
35-
NSMutableDictionary *result = [NSMutableDictionary new];
36-
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(NSString *name, NSRelationshipDescription *relation, BOOL *stop) {
37-
if(relation.isToMany == NO) {
38-
return;
39-
}
40-
result[name] = relation;
41-
}];
42-
return result;
34+
- (NSDictionary<NSString*, NSRelationshopDescription*> *)toManyRelationshipsByName_cde {
35+
NSMutableDictionary *result = [NSMutableDictionary new];
36+
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(NSString *name, NSRelationshipDescription *relation, BOOL *stop) {
37+
if(relation.isToMany == NO) {
38+
return;
39+
}
40+
result[name] = relation;
41+
}];
42+
return result;
4343
}
4444

45-
- (NSArray *)sortedToManyRelationshipNames_cde {
46-
NSArray *unsorted = [[self toManyRelationshipsByName_cde] allKeys];
47-
return [unsorted sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSString *relationA, NSString *relationB) {
48-
return [relationA localizedStandardCompare:relationB];
49-
}];
45+
- (NSArray<NSString*> *)sortedToManyRelationshipNames_cde {
46+
NSArray *unsorted = [[self toManyRelationshipsByName_cde] allKeys];
47+
return [unsorted sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSString *relationA, NSString *relationB) {
48+
return [relationA localizedStandardCompare:relationB];
49+
}];
5050
}
5151

52-
- (NSArray *)sortedToManyRelationships_cde {
53-
NSMutableArray *result = [NSMutableArray new];
54-
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(id key, NSRelationshipDescription *relation, BOOL *stop) {
55-
if(relation.isToMany == NO) {
56-
return;
57-
}
58-
[result addObject:relation];
59-
}];
60-
return [result sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
61-
return [relationA.name localizedStandardCompare:relationB.name];
62-
}];
52+
- (NSArray<NSRelationshipDescription*> *)sortedToManyRelationships_cde {
53+
NSMutableArray *result = [NSMutableArray new];
54+
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(id key, NSRelationshipDescription *relation, BOOL *stop) {
55+
if(relation.isToMany == NO) {
56+
return;
57+
}
58+
[result addObject:relation];
59+
}];
60+
return [result sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
61+
return [relationA.name localizedStandardCompare:relationB.name];
62+
}];
6363
}
6464

65-
- (NSArray *)sortedToOneRelationships_cde {
66-
NSMutableArray *result = [NSMutableArray new];
67-
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(id key, NSRelationshipDescription *relation, BOOL *stop) {
68-
if(relation.isToMany) {
69-
return;
70-
}
71-
[result addObject:relation];
72-
}];
73-
return [result sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
74-
return [relationA.name localizedStandardCompare:relationB.name];
75-
}];
65+
- (NSArray<NSRelationshipDescription*> *)sortedToOneRelationships_cde {
66+
NSMutableArray *result = [NSMutableArray new];
67+
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(id key, NSRelationshipDescription *relation, BOOL *stop) {
68+
if(relation.isToMany) {
69+
return;
70+
}
71+
[result addObject:relation];
72+
}];
73+
return [result sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
74+
return [relationA.name localizedStandardCompare:relationB.name];
75+
}];
7676
}
7777

78-
- (NSArray *)sortedRelationships_cde {
79-
return [self.relationshipsByName.allValues sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
80-
return [relationA.name localizedStandardCompare:relationB.name];
81-
}];
78+
- (NSArray<NSRelationshipDescription*> *)sortedRelationships_cde {
79+
return [self.relationshipsByName.allValues sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
80+
return [relationA.name localizedStandardCompare:relationB.name];
81+
}];
8282
}
8383

84-
//- (NSString *)nameForDisplay_cde {
85-
// return [self.name humanReadableStringAccordingToUserDefaults_cde];
86-
//}
87-
8884
- (NSAttributeDescription *)attributeDescriptionForName_cde:(NSString *)attributeName {
89-
NSParameterAssert(attributeName);
90-
return self.attributesByName[attributeName];
85+
NSParameterAssert(attributeName);
86+
return self.attributesByName[attributeName];
9187
}
9288

93-
//#pragma mark - CSV
94-
//// returns an array of arrays
95-
//- (NSArray *)CSVValuesForEachManagedObjectInArray_cde:(NSArray *)objects {
96-
// NSParameterAssert(objects);
97-
// NSArray *supportedAttributes = self.supportedCSVAttributes_cde;
98-
// NSArray *supportedAttributeNames = [supportedAttributes valueForKey:@"name"];
99-
// return [self CSVValuesForEachManagedObjectInArray:objects forPropertyNames:supportedAttributeNames includeHeaderValues_cde:NO];
100-
//}
101-
//
102-
//// This method filters out any non supported property names and also respects the sorting of propertyNames
103-
//- (NSArray *)CSVValuesForEachManagedObjectInArray:(NSArray *)objects forPropertyNames:(NSArray *)propertyNames includeHeaderValues_cde:(BOOL)includeHeaderValues {
104-
// NSParameterAssert(objects);
105-
// NSParameterAssert(propertyNames);
106-
//
107-
// NSMutableArray *supportedAttributeNames = [NSMutableArray new];
108-
// for(NSString *propertyName in propertyNames) {
109-
// if([propertyName isEqualToString:@"objectID"]) {
110-
// [supportedAttributeNames addObject:propertyName];
111-
// continue;
112-
// }
113-
// NSAttributeDescription *attribute = self.attributesByName[propertyName];
114-
// if(attribute == nil) {
115-
// continue;
116-
// }
117-
// if(!attribute.isSupportedAttribute_cde || !attribute.isSupportedCSVAttribute_cde) {
118-
// continue;
119-
// }
120-
// [supportedAttributeNames addObject:attribute.name];
121-
// }
122-
//
123-
// NSMutableArray *result = [NSMutableArray arrayWithCapacity:objects.count + 1];
124-
//
125-
// if(includeHeaderValues) {
126-
// [result addObject:supportedAttributeNames];
127-
// }
128-
//
129-
// for(NSManagedObject *object in objects) {
130-
// NSAssert([object.entity isKindOfEntity:self], @"Entity mismatch");
131-
// NSArray *values = [object CSVValuesForAttributeNames_cde:supportedAttributeNames];
132-
// [result addObject:values];
133-
// }
134-
//
135-
// return result;
136-
//}
137-
//
138-
//- (NSArray *)supportedCSVAttributes_cde {
139-
// NSMutableArray *result = [NSMutableArray new];
140-
// for(NSAttributeDescription *attribute in self.supportedAttributes_cde) {
141-
// if(attribute.isSupportedCSVAttribute_cde) {
142-
// [result addObject:attribute];
143-
// }
144-
// }
145-
// return result;
146-
//}
147-
14889
#pragma mark - UI
14990
- (UIImage *)icon_cde {
15091
return nil;
151-
// return [UIImage imageNamed:@"entity-icon-small"];
15292
}
15393

15494
@end

0 commit comments

Comments
 (0)