Auditing potentially async code

I'm looking at switching to the async versions of imported Objective-C APIs, but it's not really trivial to find where I'm using the traditional callback-based APIs. With my rigorous use of trailing closures, there are practically no instances of completion: parameter labels and such, and the Xcode 13 beta did not offer to help me with this transition. Are there tools or techniques for finding these?

A regex that finds a { followed on the same line by in may help. I can't help write such a regex, though.

There’s a pitch for an attribute that will generate a warning when you use a callback-based API in an async context.

Warning in all contexts would be unhelpful, since you can’t use the async variants in a non-async context, but warning in such cases on an opt-in basis (gasp! Dialects!) or building an external tool on top of SwiftSyntax might be feasible.

Terms of Service

Privacy Policy

Cookie Policy