Open mrh-is opened 6 years ago
I combined this SO answer with this blog post so the block can return a generic something. Header & implementation here. Use like:
if let foo = try? ObjCException.try({ return funcThatThrowsObjCException() }) { print(foo) } // or do { let foo = try ObjCException.try(funcThatThrowsObjCException) print(foo) } catch { print(error) }
I combined this SO answer with this blog post so the block can return a generic something. Header & implementation here. Use like: