Giter VIP home page Giter VIP logo

typefill's Introduction

TypeFill

Quality gate Swift


A little cli tool to help you fill your variables type.

And add private final attribute to @IBAction, @IBOutlet, and @objc.(Rewriting ...)

Installation


make

brew install make
make install

Swift Package Manager

swift build -c release
cp .build/release/typefill /usr/local/bin

mint

brew install mint
mint install yume190/TypeFill

Usage

typefill single    --sdk macosx         --file PATH/TO/sample.swift 

typefill spm       --module TypeFillKit --file .       
typefill project   --module YOUR_SCHEME --file PATH/TO/YOUR.xcodeproj 
typefill workspace --module YOUR_SCHEME --file PATH/TO/YOUR.xcworkspace

The Support Part & Todolist

  • typefill variables like let a = 1 or var a = "1".
  • typefill keyword like let ``default`` = 1.
  • typefill guard let and if let.
  • typefill some closure input.
    • { a, b in }
    • { (a, b) in }
  • typefill binding tuple let (aa, bb) = (1, 2)
  • typefill inout
  • typefill closure output.
  • add private final attribute to @IBAction/@IBOutlet/@objc by using --ibaction/--iboutlet/--objc.(Rewriting)
private lazy var chartHeight: [CGFloat] = {
    return self.status.sensorData?.compactMap { sensor -> CGFloat in
        guard let _chartType = sensor.chart?.type else { return 0 }
    }
}()

Support

let/var

let a = 1
var b = a
let (c, d) = (1, 2)
struct Test {
    let a, b: Int
    let c = 1, d = 2
}
let a: Int = 1
var b: Int = a
let (c, d): (Int, Int) = (1, 2)
struct Test {
    let a: Int, b: Int
    let c: Int = 1, d: Int = 2
}

Option bind(if let/guard let)

let a: Int? = nil
if let aa = a {}
guard let aa = a else {return}
let a: Int? = nil
if let aa: Int = a {}
guard let aa: Int = a else {return}

Closure

let a: (Int, Int) -> String = { a, b -> String in
    return ""
}
let b: (Int, Int) -> String = { (a, b) -> String in
    return ""
}
let a: (Int, Int) -> String = { (a: Int, b: Int) -> String in
    return ""
}
let b: (Int, Int) -> String = { (a: Int, b: Int) -> String in
    return ""
}

Not Support

Closure(inout)

let a: (inout Int) -> Int = { i in
    return i
}

Ref

License

MIT licensed.

typefill's People

Contributors

ytyubox avatar yume190 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ytyubox nick6969

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.