How to modify SWIFT_MODULE_NAME?
SWIFT_MODULE_NAME, PRODUCT_MODULE_NAME, PRODUCT_NAME, EXECUTABLE_NAME
Default values:
EXECUTABLE_NAME = $EXECUTABLE_PREFIX$PRODUCT_NAME$EXECUTABLE_SUFFIX
SWIFT_OBJC_INTERFACE_HEADER_NAME = $(SWIFT_MODULE_NAME)
SWIFT_MODULE_NAME = $(PRODUCT_MODULE_NAME)
PRODUCT_MODULE_NAME = $(PRODUCT_NAME:c99extidentifier)
PRODUCT_NAME = $(TARGET_NAME:c99extidentifier)
Observation:
SWIFT_MODULE_NAME == PRODUCT_MODULE_NAME
c99extidentifier
Xcode is able to substitute a value of variable
c99extidentifier
identifier which supports extended characters from C99
//for example
PRODUCT_NAME = My Framework
PRODUCT_MODULE_NAME = $(PRODUCT_NAME:c99extidentifier) = My_Framework
EXECUTABLE_NAME
name of binary
Product Module Name(PRODUCT_MODULE_NAME)
determines how the import
statement will look like. For example when you are creating a Library
or a Framework
.
Using:
//Objective-C
@import module_name;
//Swift
import module_name
Product Name(PRODUCT_NAME)
determines the name of binary. E.g. MyFramework.framework
[TARGET_NAME]
Rule is:
SWIFT_MODULE_NAME should equal to PRODUCT_MODULE_NAME
[Custom .modulemap]
The module name comes from the Product Module Name build setting:
The SWIFT_MODULE_NAME
setting is apparently hidden, but you can see its derivation by looking at Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/XCLanguageSupport.xcplugin/Contents/Resources/Swift.xcspec
:
...
{
Name = "SWIFT_MODULE_NAME";
Type = String;
DefaultValue = "$(PRODUCT_MODULE_NAME)";
CommandLineArgs = (
"-module-name",
"$(value)",
);
},
...