ios – 在Swift中,如何以名称导入目标?

前端之家收集整理的这篇文章主要介绍了ios – 在Swift中,如何以名称导入目标?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这可能是一个非常基本的东西,但是我找不到答案…

说我的Xcode项目有两个目标:foo-bar和foo-barTests

现在如果我想在foo-barTests中显示foo-bar中的标识符,那么如何导入?

解决方法

好吧,这是非常 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相关文章