You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -40,7 +40,7 @@ Both `swift-draw` and `swift-game` vend modules with the same name `Utils`, thus
40
40
dependencies: [
41
41
.product(name: "Utils",
42
42
package: "swift-draw"),
43
-
.product(name: "UtilsProduct",
43
+
.product(name: "Utils",
44
44
package: "swift-game",
45
45
moduleAliases: ["Utils": "GameUtils"]),
46
46
])
@@ -51,8 +51,6 @@ The value for the `moduleAliases` parameter is a dictionary where the key is the
51
51
52
52
To use the aliased module, `App` needs to reference the the new name, i.e. `import GameUtils`. Its existing `import Utils` statement will continue to reference the `Utils` module from package `swift-draw`, as expected.
53
53
54
-
Note that the names being disambiguated here are the conflicting module names, not the product names, thus the product names of each package are still required to be unique. If the vended product name of `swift-game` is `Utils` instead of `UtilsProduct` in the example above, it will throw a `multiple products named "Utils"' error as it does today.
55
-
56
54
### Example 2
57
55
58
56
`App` imports a module `Utils` from a package `swift-draw`. It wants to add another package dependency `swift-game` and imports a module `Game` vended from the package. The `Game` module imports `Utils` from the same package.
@@ -153,4 +151,3 @@ The alias `SwiftUtils` defined in `swift-game` will be overridden by the value `
153
151
* A module being aliased cannot be a prebuilt binary due to the impact on mangling and serialization, i.e. source-based only.
154
152
* A module being aliased should not be passed to a runtime call such as `NSClassFromString(...)` that converts (directly or indirectly) String to a type in a module since such call will fail.
155
153
* If a target mapped to a module being aliased contains resources, they should be asset catalogs, localized strings, or resources that do not require explicit module names.
156
-
* Module aliasing disambiguates conflicting module names which affect the corresponding target names, thus the product names of each package are still required to be unique.
0 commit comments