Added Swift compile time check setting. Fixed issue, and then Xcode stopped beachballing, which means I can move back from my laptop to my iMac. Whew.

This commit is contained in:
Brent Simmons 2017-08-19 12:27:54 -07:00
parent 8d5d94e1a9
commit 0186aeffa2
2 changed files with 14 additions and 7 deletions

View File

@ -565,6 +565,7 @@
INFOPLIST_FILE = RSDatabase/Info.plist; INFOPLIST_FILE = RSDatabase/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-function-bodies=25";
PRODUCT_BUNDLE_IDENTIFIER = com.ranchero.RSDatabase; PRODUCT_BUNDLE_IDENTIFIER = com.ranchero.RSDatabase;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
@ -585,6 +586,7 @@
INFOPLIST_FILE = RSDatabase/Info.plist; INFOPLIST_FILE = RSDatabase/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-function-bodies=25";
PRODUCT_BUNDLE_IDENTIFIER = com.ranchero.RSDatabase; PRODUCT_BUNDLE_IDENTIFIER = com.ranchero.RSDatabase;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;

View File

@ -38,22 +38,27 @@ public final class DatabaseLookupTable {
attachRelationshipsUsingLookupTable(to: objects, lookupTable: lookupTable, database: database) attachRelationshipsUsingLookupTable(to: objects, lookupTable: lookupTable, database: database)
} }
public func saveRelationships(for objects: [DatabaseObject], relationshipName: String, database: FMDatabase) { public func saveRelationships(for objects: [DatabaseObject], database: FMDatabase) {
var objectsWithNoRelationships = [DatabaseObject]() var objectsWithNoRelationships = [DatabaseObject]()
var objectsWithRelationships = [DatabaseObject]() var objectsWithRelationships = [DatabaseObject]()
objects.forEach { (object) for object in objects {
if let relatedObjects = object.relatedObjectsWithName(relationshipsName) if let relatedObjects = object.relatedObjectsWithName(relationshipName), !relatedObjects.isEmpty {
objectsWithRelationships += [object]
}
else {
objectsWithNoRelationships += [object]
}
} }
removeRelationships(for: objectsWithNoRelationships, database: database)
} }
} }
private extension DatabaseLookupTable { private extension DatabaseLookupTable {
func removeRelationships(for objects: [DatabaseObject], relationshipName: String, database: FMDatabase) { func removeRelationships(for objects: [DatabaseObject], database: FMDatabase) {
removeLookupsForForeignIDs(objects.databaseIDs(), database) removeLookupsForForeignIDs(objects.databaseIDs(), database)
} }
@ -196,7 +201,7 @@ struct LookupValue: Hashable {
self.primaryID = primaryID self.primaryID = primaryID
self.foreignID = foreignID self.foreignID = foreignID
self.hashValue = "\(primaryID)\(foreignID)".hashValue self.hashValue = (primaryID + foreignID).hashValue
} }
static public func ==(lhs: LookupValue, rhs: LookupValue) -> Bool { static public func ==(lhs: LookupValue, rhs: LookupValue) -> Bool {