File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+ * SPDX-License-Identifier: Apache-2.0.
4+ */
5+
6+ package software.amazon.smithy.swift.codegen
7+
8+ import software.amazon.smithy.swift.codegen.model.buildSymbol
9+
10+ object FoundationTypes {
11+ val TimeInterval = builtInSymbol(" TimeInterval" )
12+ }
13+
14+ private fun builtInSymbol (symbol : String ) = buildSymbol {
15+ name = symbol
16+ namespace = " Foundation"
17+ }
Original file line number Diff line number Diff line change @@ -110,6 +110,12 @@ class SwiftWriter(private val fullPackageName: String) : CodeWriter() {
110110 imports.addImport(" Foundation" , false )
111111 }
112112
113+ // Adds an import statement that imports the individual type from the specified module
114+ // Example: addIndividualTypeImport("struct", "Foundation", "Date") -> "import struct Foundation.Date"
115+ fun addIndividualTypeImport (kind : String , module : String , type : String ) {
116+ imports.addImport(" $kind $module .$type " , false )
117+ }
118+
113119 fun addImportReferences (symbol : Symbol , vararg options : SymbolReference .ContextOption ) {
114120 symbol.references.forEach { reference ->
115121 for (option in options) {
You can’t perform that action at this time.
0 commit comments