We've totally forgotten to capture self and its properties when referencing it within a closure. (Note: the compiler didn't warn us.) Now our application is full with strong reference cycles. To fix them, we have to add the capture list to each closure one-by-one.
How can we find them all? I thought to search for in
but it results in too much results including comments, for cycles.
Good old Objective C would help me searching for ^
. And it would warn us...
ClosureExpression
s. I've not tried this yet, but if you find out something, you could inform us if it was helpful or not :-) – Bolshevistin
, did you tell Xcode to use "matching word" rather than "contains". That can reduce false positives. Or you can do regular expression search and then specify to find only those occurrences ofin
that appear at the end of a line:\bin\s*$
. That won't catch inline closures or those missingin
altogether, but might find a certain percentage of your closures. You can alter that regex as you see fit to be tailored for the sort of patterns you employed in your project. – Harmon