As Swift 6 release approaches it is going to become imperative that we all mark existential types with any
. Xcode does offer solution in form of fixit but that is still not enough for large codebases. Failing to explicitly mark existential types will result in compilation error once Swift 6 is out.
This is a command line tool written in Swift that utilizes Apple's Swift Syntax library to find all protocol declarations. Then it rewrites all
existential types such that keyword any
is added before type annotation. It also relies on Argument parser to provide common command line functionality in addition to parsing the single argument that this tool takes.
You can install existentialannotator using Homebrew.
- Open Terminal
- Run
brew install adincebic/brew/existentialannotator
- In Terminal
cd
in to your project directory where you want to perform the annotation. - Run
existentialannotator .
and let it do its magic.
While existentialannotator does what it is supposed to, this is just a project that I hacked together to help myself. If you find something that needs improvement, feel free to open a pull request and I will do my best to respond in a timely manor.