ios - 在 Swift 中,如何导入名称中带有破折号的目标?

标签 ios macos swift

这可能是一些非常基本的东西,但我就是找不到答案......

假设我的 Xcode 项目中有两个目标:foo-bar 和 foo-barTests

现在,如果我想让来自 foo-bar 的标识符在 foo-barTests 中可见,我该如何导入它?

最佳答案

好吧,非常basic :

Naming Your Product Module

The name of the Xcode-generated header for Swift code, and the name of the Objective-C bridging header that Xcode creates for you, are generated from your product module name. By default, your product module name is the same as your product name. However, if your product name has any non-alphanumeric characters, such as a period (.), they are replaced with an underscore (_) in your product module name. If the name begins with a number, the first number is replaced with an underscore.

You can also provide a custom name for the product module name, and Xcode will use this when naming the bridging and generated headers. To do this, change the Product Module Name build setting.

所以 import foo-bar 变成了 import foo_bar

关于ios - 在 Swift 中,如何导入名称中带有破折号的目标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26012565/

相关文章:

ios - iPhone sleep 时 Firebase onDisconnect 被触发

iphone - 从 NSDictionary 我只得到 0 或 null 我该怎么办?

swift - 类型 'PFFacebookUtils' 在 swift 上没有成员 'session'

IOS 10,JSQMessagesAvatarImageFactory.avatarImage(未知参数)的当前语法是什么

macos - 如何在 iOS 和 OS X 之间创建单一共享框架

java - 带有嵌入斜杠的奇怪文件名 - Mac/Windows 冲突

macos - 如何减少 Docker 在 MacOS 中使用的空间?

ios - 从 UIWebView 获取 img 标签响应 header

ios - CoreImage 的内存泄漏

ios - 无法将 NSData 转换为 NSString