Anyone done an Objective-C Xode version of Osherove´s TDD Kata “String Calculator”?

落爺英雄遲暮 提交于 2019-12-01 08:35:33

I did that. You can find the screencast and the Xcode project here in my blog. I’ve written the text around it in german, but you should have no trouble playing the video or finding the download link.

I'd use NSPredicate like this:

NSPredicate * parsed = [NSPredicate predicateWithFormat:@"6 * 7 = 0"];
NSExpression * left = [(NSComparisonPredicate *)parsed leftExpression];
NSNumber * result = [left expressionValueWithObject:nil context:nil];
NSLog(@"result: %@", result);

Look here for more info on using NSPredicate in weird ways.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!