ios - 无法在 swift 中使用 Objective C 语句/数据类型

标签 ios objective-c swift

我试图在我的 Swift 项目中使用 Objective C 中的类,我在链接器标志中添加了依赖项“-ObjC”,并且还使用了桥接 header 。基本上,除了这个之外,所有其他 Objective C 类和库都可以工作。

enter image description here

最佳答案

NSColor 适用于 Mac OS X,而非 iOS。 它的“等价物”是UIColor

这就是为什么编译器说它不知道NSColor

关于ios - 无法在 swift 中使用 Objective C 语句/数据类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31582311/

相关文章:

ios - 我们可以为返回可选值的 swift 函数添加 @objc 吗?

objective-c - 在两个 View Controller 之间传递字典?

ios - Apple swift 2.1 中的数组升级

ios - 新 iTunes 连接中的 IPA 大小错误?

iphone - 将音频从 iPhone 传输到浏览器。有想法吗?

iphone - NSDateFormatter——没有得到正确的格式化程序字符串

ios - 在关闭之前的 AlertViewController 之后呈现新的 AlertViewController - Swift

ios - 在 Swift 中将类属性添加到协议(protocol)

ios - 从 Swift 函数中的异步调用返回数据

objective-c - tableview 的问题