I have an Obj-C project with CocoaPods. Now I need to use DDMathParser, written in Swift. But can not import DDMathParser correctly. When I add new Swift file to the project, it works fine. DDMathParser is not working even in swift file I've created. Here's a bit of my code:
#import "ViewController.h"
#import "test-Swift.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
SwiftTest *test = [[SwiftTest alloc] init];
[test run];
NSLog(@"%@", [@"5 + 5" numberByEvaluatingString]);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
What I must do to make it work?
P.S. Bridging header created and working. In build settings "Defines Modules" set to YES
CocoaPods file:
pod 'AFNetworking'
pod 'DDMathParser'
use_frameworks!
pod 'DDMathParser'
This implies that you're using version 3.0 of DDMathParser, which was recently re-written in Swift, and in which the method numberByEvaluatingString
does not exist. It was renamed to evaluate
.