Skip to content

A refactoring tool to support the adoption of `ExistentialAny` in your Swift codebase.

License

Notifications You must be signed in to change notification settings

nhiroyasu/ExistentialAnyRefactor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExistentialAnyRefactor

A refactoring tool to support the adoption of ExistentialAny in your Swift codebase.

Feature

  • This tool scans the specified Swift files for protocols and automatically adds the any keyword to all instances where those protocols are used.
// Before
protocol P {}

class C {
    let p: P
    let p2: [P]
    let p3: [Int: P]
    let p4: P & Q
    func f(p: P) -> P
}
// After
protocol P {}

class C {
    let p: any P
    let p2: [any P]
    let p3: [Int: any P]
    let p4: any P & Q
    func f(p: any P) -> any P
}

Warning

  • Not all protocols can have any applied to them. Types defined within the SDK cannot be scanned, and therefore may not be refactored.
  • In cases where the code is complex, the any keyword might not be applicable. Please consider this tool as a support tool for your refactoring process.

Usage

$ swift build -c release
$ ./.build/release/existential-any-refactor <target-paths> [--obvious_existential_types <types>]

About

A refactoring tool to support the adoption of `ExistentialAny` in your Swift codebase.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages