I have a rather simple question I hope has a simple answer. I am using Swift's filter
method to filter a collection of objects using the anonymous closure argument $0
:
let filteredArray = myArray.filter {
$0.name != "Bob"
}
I have set a breakpoint inside the filter closure and just want to inspect the value of $0
, but when I type po $0
on the console it gives me:
(lldb) po $0
error: :2:1: error: anonymous closure argument not contained in a closure
$0
^
How can I get around this?
To be clear, the code compiles and runs, but gives me this error on the console at runtime.
This is a known issue with Xcode 8.1 GM Seed. From the release notes:
Anonymous closure arguments in Swift cannot be used in LLDB expressions. For example,
po $0
is not supported.
You can use the frame variable command to print its value:
fr va $0
This issue is filed as rdar://28611943
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With