我目前正在尝试将objective-c 代码转换为openEars 提供的示例应用程序的swift。但是有这一行代码:
[[OEPocketsphinxController sharedInstance] setActive:TRUE error:nil];
这是如何用swift写的?
它在框架中是这样定义的:
+ (OEPocketsphinxController *)sharedInstance;
/**This needs to be called with the value TRUE before setting properties of OEPocketsphinxController for the first time in a session, and again before using OEPocketsphinxController in case it has been called with the value FALSE.*/
- (BOOL)setActive:(BOOL)active error:(NSError **)outError;
但是我确实尝试过这样的事情:
OEPocketsphinxController(TRUE, error: nil)
编译器错误是:
Swift 编译器错误预期声明