如何在Xcode中使用plus()符号导入Swift模块

我正在尝试导入一个名为“ NSObject+Rx”的模块,但是Xcode抱怨一个模糊的错误(用等分隔的连续语句).
import NSObject+Rx

知道如何导入具有这样的特殊字符的模块吗?

解决方法

Apple docs开始:

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 nonalphanumeric 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.

NOTE

You cannot override the product module name of a framework.

在您的情况下,将NSObject Rx替换为NSObject_Rx,或通过更改“产品模块名称”构建设置来设置您自己的名称.

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...