By supporting Frameworks and Swift, we have also support Clang modules. Module names are C99-extended identifiers, which means [a-Z_][a-Z0-9_]*. Some podspecs use names beginning with a number or containing - or .. These characters are not possible in the module name and would be replaced by _. (That's the same what happens by e.g. ${PRODUCT_NAME:c99ext_identifier}.)
@orta proposed, we could solve that by allowing to define an alternative module name by the Podspec DSL. At the moment you can give your library another name for imports by specifying the header_dir in the podspec. E.g. it is solved in that way for Facebook-iOS-SDK. This option is currently not considered for frameworks on CocoaPods/CocoaPods#2835, so you would need to @import Facebook_iOS_SDK. We can derive it in the following way to keep maximum compatibility with user projects:
spec.module_name ?? c99ext_identifier(spec.header_dir) ?? c99ext_identifier(spec.name)
Where the attribute module_name is new to the Podsepc DSL and has to be introduced. It should be validated to allow only C99-extended identifiers.
Regarding Framework / Swift Support by CocoaPods/CocoaPods#2835:
By supporting Frameworks and Swift, we have also support Clang modules. Module names are C99-extended identifiers, which means
[a-Z_][a-Z0-9_]*. Some podspecs use names beginning with a number or containing-or.. These characters are not possible in the module name and would be replaced by_. (That's the same what happens by e.g.${PRODUCT_NAME:c99ext_identifier}.)@orta proposed, we could solve that by allowing to define an alternative module name by the Podspec DSL. At the moment you can give your library another name for imports by specifying the
header_dirin the podspec. E.g. it is solved in that way for Facebook-iOS-SDK. This option is currently not considered for frameworks on CocoaPods/CocoaPods#2835, so you would need to@import Facebook_iOS_SDK. We can derive it in the following way to keep maximum compatibility with user projects:Where the attribute
module_nameis new to the Podsepc DSL and has to be introduced. It should be validated to allow only C99-extended identifiers.