DDMathParser
DDMathParser copied to clipboard
Errors Thrown from here are not handled
I'm trying to use DDMathParser in its simplest form of the copy and pasting the code provided in the Wiki and i get the error that is in the title of this issue for this code.
let value = try "1 + 2".evaluate()
Im using Xcode 7 with Swift 2 and installed DDMathParser with CocoaPods.
As mentioned on the Errors wiki page, you need to perform this within a do ... catch
block.
I'll leave this open as a request to expand the wiki article on how to effectively deal with errors.
but where the right way example? i create a new blank project anh write the first example code is let value = try "1 + 2".evaluate() and get this error? please help for begining useer! Thank you so much!
@kanjizu Im not sure why he is not putting fully working code in the Documentation but here is what you need to do.
do {
let value = try "1 + 2".evaluate()
} catch {
print(error)
}