How to modify SWIFT_MODULE_NAME?
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)",
);
},
...
iOS changing target name
Just Click on your target Name beside stop button > Manage Schemes > Select and change name
Conversion to Swift 5 produces 'Multiple commands produce x86_64.swiftmodule' error
I was able to partly solve this issue by adjusting SWIFT_MODULE_NAME property in Test target.
My test's target SWIFT_MODULE_NAME was same as main target name, so i changed it
How to get the compiler to prefer my function over a Swift general function?
With function overloads, the compiler always prefers the most specialised version. If your function isn't more specialised than the built in one, but simply adds more input parameter with default input arguments, the compiler cannot distinguish it from the Swift standard library one.
You need to use names-acing and call your function with your own module name, like
MyModule.assert(1 == 2)
Objective C to Swift header file with multiple targets
It is also possible to set the Product Module Name
setting in Build Settings
to be the same across your modules (I set it to $(PROJECT_NAME)
), so that the
file that is generated has the same name across all modules. This eliminates the need for adding/checking preprocessor macros.
Static Library and Swift
As of Xcode 9 beta 4, Xcode natively supports static libraries with Swift sources.
Static Library and Swift
As of Xcode 9 beta 4, Xcode natively supports static libraries with Swift sources.
Adding Swift file to my project causes invalid module error
Since you're retrofitting Swift, please check:SWIFT_MODULE_NAME
under build settings in the target (and additionally at the project level perhaps if you have more targets).
It should be SOMETHING (versus blank), usually ${BUNDLE_DISPLAY_NAME} but you can hard-code it for starters.
There may be other settings like default module name for XIB also.
Related Topics
Get a List of All Contacts on Ios
Making Text Bold Using Attributed String in Swift
Get the Current Scroll Position of a Swiftui Scrollview
How to Pass Data Between View Controllers in Swift
Can Afnetworking Return Data Synchronously (Inside a Block)
Detecting Sheet Was Dismissed on iOS 13
How to Disable the Uitableview Selection
A Complete Solution to Locally Validate an In-App Receipts and Bundle Receipts on iOS 7
How to Simultaneously Satisfy Constraints, Will Attempt to Recover by Breaking Constraint
Delete Keychain Items When an App Is Uninstalled
Proper Use of Beginbackgroundtaskwithexpirationhandler
Ineligible Devices Section Appeared in Xcode 6.X.X
Detect If the App Was Launched/Opened from a Push Notification
Uicollectionview - Dynamic Cell Height
How to Put Buttons Over Uitableview Which Won't Scroll With Table in Ios
Ios App With Arc, Find Who Is Owner of an Object
How to Get the Status of Bluetooth (On/Off) in iPhone Programmatically