Apple has released the code of its Swift Migrator tool. The new development is touted to be rewritten to meet the requirements for Swift 4.
The Swift Migrator tool is a part of Xcode 9 that was debuted at WWDC 2017 last month. The tool supports Swift 3 as well as Swift 4 programming languages and is capable of migrating individual targets in Xcode.
“At the start of the normal frontend invocation, the compiler parses and type-checks the primary input, resulting in a type-checked AST, which is handed to the Migrator if one of the above flags were passed. For this initial step, the Migrator uses whatever Swift language version that was passed to the frontend,” reads the description of the Migrator tool.
Compiler binary
The Migrator tool uses a compiler binary to parse and type-check the primary input. It includes passes such as the pre-fix-it, AST and post-fix-it that all take an input source text and produce and output source text.
Additionally, Apple engineers have provided migration states that work in line with the Migrator tool to describe the changes in a particular state — being an immutable container.
The Swift Migrator tool is available for access on GitHub. The library includes a JSON and C++ code mix.