Skip to content

Commit

Permalink
More dynamic GQL response parsing
Browse files Browse the repository at this point in the history
Added ability to parse GQL response where field data is encapsulated in a dictionary; Changed project structure to try to get Readme to display in Xcode Package search
  • Loading branch information
ecrichlow committed Sep 22, 2022
1 parent 5041ec2 commit 0f20385
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
10 changes: 4 additions & 6 deletions IoGInfrastructure.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
8E76F5E5285712740043F6B5 /* IoGLiveDataRequestResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E76F5D7285712740043F6B5 /* IoGLiveDataRequestResponse.swift */; };
8E76F5E6285712740043F6B5 /* IoGLiveDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E76F5D8285712740043F6B5 /* IoGLiveDataManager.swift */; };
8EF416692871094F006E43D7 /* TestDependent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EF416682871094F006E43D7 /* TestDependent.swift */; };
OBJ_38 /* Package.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_6 /* Package.swift */; };
OBJ_49 /* EncryptionKeyManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_13 /* EncryptionKeyManagerTests.swift */; };
OBJ_50 /* IoGDataManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_14 /* IoGDataManagerTests.swift */; };
OBJ_51 /* IoGDataParsingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_15 /* IoGDataParsingTests.swift */; };
Expand Down Expand Up @@ -389,7 +388,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 0;
files = (
OBJ_38 /* Package.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -432,7 +430,7 @@
OBJ_28 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CURRENT_PROJECT_VERSION = 14;
CURRENT_PROJECT_VERSION = 15;
DRIVERKIT_DEPLOYMENT_TARGET = 19.0;
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -444,7 +442,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MARKETING_VERSION = 3.7;
MARKETING_VERSION = 3.8;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "$(inherited)";
Expand All @@ -463,7 +461,7 @@
OBJ_29 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CURRENT_PROJECT_VERSION = 14;
CURRENT_PROJECT_VERSION = 15;
DRIVERKIT_DEPLOYMENT_TARGET = 19.0;
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -475,7 +473,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MARKETING_VERSION = 3.7;
MARKETING_VERSION = 3.8;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "$(inherited)";
Expand Down
15 changes: 14 additions & 1 deletion Source/IoGInfrastructure/Managers/GraphQL/IoGGQLManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,20 @@ public class IoGGQLManager: IoGDataManagerDelegate
if let objectDictionary = jsonDict as? [String: Any]
{
let returnObject = target.init()
assignDataToFields(target: returnObject, fields: objectDictionary)
if objectDictionary.keys.count == 1
{
if let key = objectDictionary.keys.first
{
if let dataDictionary = objectDictionary[key] as? [String: Any]
{
assignDataToFields(target: returnObject, fields: dataDictionary)
}
}
}
else
{
assignDataToFields(target: returnObject, fields: objectDictionary)
}
return returnObject
}
}
Expand Down

0 comments on commit 0f20385

Please sign in to comment.