From 81d8d710158e4c6946e248b6f914e6e673004173 Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Mon, 30 Oct 2023 20:06:24 -0700 Subject: [PATCH] Add special-case import statement for FoundationNetworking if OS is linux. --- .../amazon/smithy/aws/swift/codegen/PresignerGenerator.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGenerator.kt index f497654f09c..de28ca337bc 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGenerator.kt @@ -55,6 +55,11 @@ class PresignerGenerator : SwiftIntegration { val symbol = protoCtx.symbolProvider.toSymbol(protoCtx.service) protoCtx.delegator.useFileWriter("./${ctx.settings.moduleName}/${symbol.name}.swift") { writer -> renderPresignAPIInServiceClient(writer, symbol.name, op, inputType) + // Add special-case import statement for Linux + writer.write("// In Linux, Foundation.URLRequest is moved to FoundationNetworking.") + writer.write("#if canImport(FoundationNetworking)") + writer.write("import FoundationNetworking") + writer.write("#endif") } } }