1

我想将DDMathParser库与 Objective-C 一起使用,但它是用 Swift 编写的。这是我到目前为止所尝试的:

#import <MathParser/MathParser.h>

// ...

// This throws error:
Expression *e;

这不会构建,因为编译器找不到 DDMathParser 声明的“表达式”类型。我还尝试将我的导入语句切换为:

#import <MathParser/MathParser-Swift.h>

但仍然没有运气。

我无法在网上找到在 Objective-C 中使用这个库的任何示例。我是 Objective-C 的新手,所以我什至不知道要使用什么 import 语句;也许其他人会发现这个常识?

4

1 回答 1

1

DDMathParser 的 Swift 版本不是为了在 Objective-C 中可用而编写的;它被写成类似 Swift 的。

如果您需要使用 Objective-C 中的 DDMathParser,我建议使用标记处的objc代码;这是 Objective-C 代码的最新版本:https ://github.com/davedelong/DDMathParser/releases/tag/objc

于 2015-11-15T23:56:20.077 回答