Here is my understanding:
-
module: A group of interrelated sources intended to always be built together. (cf. whole module optimization). This is what is referenced when you
import MyModule
, and when you use its name for disambiguating a symbol:MyModule.Data
vsFoundation.Data
.- In general English, a module is “one of a set of standardized parts or independent units that can be used to construct a more complex structure”
-
target: A unit of the build result; a particular thing you might aim to build on its own. A Swift target is pretty much equal to a Swift module, so they are often used interchangeably. However module tends to refer more to the grouping whereas target refers more to the result. Another difference is that a target does not necessarily have to contain source; it could be something else such as a resource bundle and such a target is not a module. Targets are referenced by the package manifest’s
.target(...)
andtestTarget(...)
, and by Xcode under “File → New → Target...” and so on.- In general English, a target is “a mark or point at which one fires or aims” or “an objective or result towards which efforts are directed”
-
product: A unit of functionality you want to vend to clients. Often a product is also a single target, but the reverse is not true. Many targets are not intended for others to use (such as test targets), and those are never described as products. Products are defined in the package manifest’s
products
argument and referenced in client target’s dependency list with.product(...)
(unless the reference is reduced to a string literal).- In general English, a product is “an article or substance that is manufactured or refined for sale”