Skip to content

Commit

Permalink
Add CodegenProposal.md & clean up project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyMDev committed Sep 22, 2021
1 parent c4fafc7 commit cf43742
Show file tree
Hide file tree
Showing 24 changed files with 1,117 additions and 41 deletions.
3 changes: 1 addition & 2 deletions Apollo.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ Pod::Spec.new do |s|
s.watchos.deployment_target = '5.0'

s.subspec 'Core' do |ss|
ss.source_files = 'Sources/Apollo/*.swift','Sources/ApolloUtils/*.swift','Sources/ApolloAPI/*.swift'
ss.exclude_files = 'Sources/ApolloAPI/CodegenV1/*.swift'
ss.source_files = 'Sources/Apollo/*.swift','Sources/ApolloUtils/*.swift','Sources/ApolloAPI/*.swift'
ss.preserve_paths = [
'scripts/run-bundled-codegen.sh',
]
Expand Down
41 changes: 17 additions & 24 deletions Apollo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
DE6B156A261505660068D642 /* GraphQLMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6B154A261505450068D642 /* GraphQLMap.swift */; };
DE6B15AF26152BE10068D642 /* DefaultInterceptorProviderIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6B15AE26152BE10068D642 /* DefaultInterceptorProviderIntegrationTests.swift */; };
DE6B15B126152BE10068D642 /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; };
DE736F4626FA6EE6007187F2 /* InflectorKit in Frameworks */ = {isa = PBXBuildFile; productRef = E6E4209126A7DF4200B82624 /* InflectorKit */; };
DE9C04AC26EAAE4400EC35E7 /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC4B91F1D2A6F8D0046A641 /* JSON.swift */; };
DE9C04AD26EAAE5400EC35E7 /* JSONStandardTypeConversions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F27D4631D40379500715680 /* JSONStandardTypeConversions.swift */; };
DE9C04AF26EAAEE800EC35E7 /* CacheReference.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE9C04AE26EAAEE800EC35E7 /* CacheReference.swift */; };
Expand Down Expand Up @@ -930,7 +931,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E6E4209226A7DF4200B82624 /* InflectorKit in Frameworks */,
DE736F4626FA6EE6007187F2 /* InflectorKit in Frameworks */,
DECD47C3262F779800924527 /* ApolloUtils.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1725,7 +1726,21 @@
9FC4B91F1D2A6F8D0046A641 /* JSON.swift */,
9F27D4631D40379500715680 /* JSONStandardTypeConversions.swift */,
DE9C04B026EAAFF900EC35E7 /* JSONDecodingError.swift */,
DE3C7B0F260A6F7F00D2F4FF /* CodegenV1 */,
DE2FCF2226E8082A0057EA67 /* SchemaTypes */,
DE2FCF1E26E807CC0057EA67 /* CacheTransaction.swift */,
DE9C04AE26EAAEE800EC35E7 /* CacheReference.swift */,
9B68F06E241C649E00E97318 /* GraphQLOptional.swift */,
DE3C7B12260A6FC900D2F4FF /* FragmentProtocols.swift */,
DE3C7B14260A6FCA00D2F4FF /* GraphQLEnum.swift */,
DE3C7B11260A6FC900D2F4FF /* ResponseDict.swift */,
DE3C7B10260A6FC900D2F4FF /* SelectionSet.swift */,
DEA6A83326F298660091AF8A /* ParentType.swift */,
DECD53D026EC48200059A639 /* ResponseObject.swift */,
DE2FCF1C26E806710057EA67 /* SchemaConfiguration.swift */,
DE664ED326602AF60054DB4F /* Selection.swift */,
DECD53CE26EC0EE50059A639 /* OutputTypeConvertible.swift */,
DE2FCF2026E807EF0057EA67 /* Cacheable.swift */,
9FC750601D2A59C300458D91 /* GraphQLOperation.swift */,
DE05862426697A8C00265760 /* Info.plist */,
);
name = ApolloAPI;
Expand Down Expand Up @@ -1806,28 +1821,6 @@
path = graphql;
sourceTree = "<group>";
};
DE3C7B0F260A6F7F00D2F4FF /* CodegenV1 */ = {
isa = PBXGroup;
children = (
DE2FCF2226E8082A0057EA67 /* SchemaTypes */,
DE2FCF1E26E807CC0057EA67 /* CacheTransaction.swift */,
DE9C04AE26EAAEE800EC35E7 /* CacheReference.swift */,
9B68F06E241C649E00E97318 /* GraphQLOptional.swift */,
DE3C7B12260A6FC900D2F4FF /* FragmentProtocols.swift */,
DE3C7B14260A6FCA00D2F4FF /* GraphQLEnum.swift */,
DE3C7B11260A6FC900D2F4FF /* ResponseDict.swift */,
DE3C7B10260A6FC900D2F4FF /* SelectionSet.swift */,
DEA6A83326F298660091AF8A /* ParentType.swift */,
DECD53D026EC48200059A639 /* ResponseObject.swift */,
DE2FCF1C26E806710057EA67 /* SchemaConfiguration.swift */,
DE664ED326602AF60054DB4F /* Selection.swift */,
DECD53CE26EC0EE50059A639 /* OutputTypeConvertible.swift */,
DE2FCF2026E807EF0057EA67 /* Cacheable.swift */,
9FC750601D2A59C300458D91 /* GraphQLOperation.swift */,
);
path = CodegenV1;
sourceTree = "<group>";
};
DE46A55926F13B4100357C52 /* Interceptors */ = {
isa = PBXGroup;
children = (
Expand Down
1,087 changes: 1,087 additions & 0 deletions CodegenProposal.md

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ let package = Package(
name: "ApolloAPI",
dependencies: [],
exclude: [
"Info.plist",
"CodegenV1"
"Info.plist"
]),
.target(
name: "ApolloUtils",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension SelectionSet {

var __objectType: Object.Type? { Schema.objectType(forTypename: __typename) }

var __typename: String { data["__typename"] }
@inlinable var __typename: String { data["__typename"] }

/// Verifies if a `SelectionSet` may be converted to a different `SelectionSet` and performs
/// the conversion.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,21 @@ struct ClassroomPetsWithSubtypesQuery {
var asPetRock: AsPetRock? { _asType() }
var asRat: AsRat? { _asType() }

var subtype: SubType { SubType(data: data) }

enum SubType {
case bird(AsBird)
case cat(AsCat)
case rat(AsRat)
case petRock(AsPetRock)
case other(ResponseDict)

init(data: ResponseDict) {
switch Schema.objectType(forTypename: data["__typename"]) {
case is Bird.Type: self = .bird(AsBird(data: data))
case is Cat.Type: self = .cat(AsCat(data: data))
case is Rat.Type: self = .rat(AsRat(data: data))
case is PetRock.Type: self = .petRock(AsPetRock(data: data))
default: self = .other(data)
}
case other(ClassroomPet)
}

var subtype: SubType {
switch __objectType {
case is Bird.Type: return .bird(AsBird(data: data))
case is Cat.Type: return .cat(AsCat(data: data))
case is Rat.Type: return .rat(AsRat(data: data))
case is PetRock.Type: return .petRock(AsPetRock(data: data))
default: return .other(self)
}
}

Expand Down

0 comments on commit cf43742

Please sign in to comment.