From df995dafd8dbeec33bc5cd79c972236849be2212 Mon Sep 17 00:00:00 2001 From: Colton Schlosser Date: Thu, 22 Aug 2019 22:08:14 -0400 Subject: [PATCH 1/2] Fix for swift 5.1 compiler warning when type is an enum with a none case --- CHANGELOG.md | 1 + .../src/__tests__/__snapshots__/codeGeneration.ts.snap | 4 ++-- packages/apollo-codegen-swift/src/codeGeneration.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f562a9fd09..b9a5bb384f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - `apollo-codegen-swift` - Replace instanceof checks with their respective predicates [#1518](https://github.com/apollographql/apollo-tooling/pull/1518) - Ensure types and strings are properly escaped in all generated code [#1515](https://github.com/apollographql/apollo-tooling/pull/1515) + - Fix warning in xcode 11 when enums have a none case [#1482](https://github.com/apollographql/apollo-tooling/pull/1482) - `apollo-codegen-typescript` - Replace instanceof checks with their respective predicates [#1518](https://github.com/apollographql/apollo-tooling/pull/1518) - `apollo-env` diff --git a/packages/apollo-codegen-swift/src/__tests__/__snapshots__/codeGeneration.ts.snap b/packages/apollo-codegen-swift/src/__tests__/__snapshots__/codeGeneration.ts.snap index 69e6149552..5e62ebc1cb 100644 --- a/packages/apollo-codegen-swift/src/__tests__/__snapshots__/codeGeneration.ts.snap +++ b/packages/apollo-codegen-swift/src/__tests__/__snapshots__/codeGeneration.ts.snap @@ -1826,7 +1826,7 @@ public struct ReviewInput: GraphQLMapConvertible { /// Comment about the movie, optional public var commentary: Swift.Optional { get { - return graphQLMap[\\"commentary\\"] as? Swift.Optional ?? .none + return graphQLMap[\\"commentary\\"] as? Swift.Optional ?? Swift.Optional.none } set { graphQLMap.updateValue(newValue, forKey: \\"commentary\\") @@ -1836,7 +1836,7 @@ public struct ReviewInput: GraphQLMapConvertible { /// Favorite color, optional public var favoriteColor: Swift.Optional { get { - return graphQLMap[\\"favorite_color\\"] as? Swift.Optional ?? .none + return graphQLMap[\\"favorite_color\\"] as? Swift.Optional ?? Swift.Optional.none } set { graphQLMap.updateValue(newValue, forKey: \\"favorite_color\\") diff --git a/packages/apollo-codegen-swift/src/codeGeneration.ts b/packages/apollo-codegen-swift/src/codeGeneration.ts index be9fcbce7d..1fa00248bf 100644 --- a/packages/apollo-codegen-swift/src/codeGeneration.ts +++ b/packages/apollo-codegen-swift/src/codeGeneration.ts @@ -1193,7 +1193,7 @@ export class SwiftAPIGenerator extends SwiftGenerator { this.printOnNewline( swift`return graphQLMap[${SwiftSource.string( name - )}] as? ${typeName} ?? .none` + )}] as? ${typeName} ?? ${typeName}.none` ); } else { this.printOnNewline( From d17e2a60ef18336cf3082ddd05c9fcd9c4eda754 Mon Sep 17 00:00:00 2001 From: Colton Schlosser Date: Thu, 12 Sep 2019 16:21:51 -0400 Subject: [PATCH 2/2] Change xcode capitalization --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9a5bb384f..41e02b8ae9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ - `apollo-codegen-swift` - Replace instanceof checks with their respective predicates [#1518](https://github.com/apollographql/apollo-tooling/pull/1518) - Ensure types and strings are properly escaped in all generated code [#1515](https://github.com/apollographql/apollo-tooling/pull/1515) - - Fix warning in xcode 11 when enums have a none case [#1482](https://github.com/apollographql/apollo-tooling/pull/1482) + - Fix warning in Xcode 11 when enums have a none case [#1482](https://github.com/apollographql/apollo-tooling/pull/1482) - `apollo-codegen-typescript` - Replace instanceof checks with their respective predicates [#1518](https://github.com/apollographql/apollo-tooling/pull/1518) - `apollo-env`