Skip to content

A command line tool that automatically marks Swift existential types with `any`

License

Notifications You must be signed in to change notification settings

adincebic/swift-existential-annotator

Repository files navigation

ExistentialAnnotator

Motivation

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.

How does Swift existentialannotator work?

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.

Installation

You can install existentialannotator using Homebrew.

  1. Open Terminal
  2. Run brew install adincebic/brew/existentialannotator

Usage

  1. In Terminal cd in to your project directory where you want to perform the annotation.
  2. Run existentialannotator . and let it do its magic.

Contributing

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.

About

A command line tool that automatically marks Swift existential types with `any`

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages