2 ms·
I was really hoping I could use it to implement some complex automated refactoring of a pretty large swift codebase (mainly from completion handlers into async/
by ninkendo 5y ago
I was really hoping I could use it to implement some complex automated refactoring of a pretty large swift codebase (mainly from completion handlers into async/await) but alas, the docs on "Syntax Rewriters" is just a "TODO".
I think this is an area where software engineering is severely lacking: the ability to "code your code", but with something more advanced than regexes. Why can't I do something like this pseudocode:
functions
.where(params.last.isClosure)
.where(returnType: Void.self)
.forEach { f in
f.setReturnType(f.params.last?.asClosure.paramsTuple)
f.setAsync(true)
f.setThrows()
}
to take functions which take a completion handler and convert them to being async? (I know it's a bunch more work than that but I feel like, even if the resulting code doesn't compile, I can fix up the resulting issues faster than having to do all of this myself.)