Skip to content

Instantly share code, notes, and snippets.

@joshavant
Created July 10, 2019 16:15

Revisions

  1. joshavant created this gist Jul 10, 2019.
    12 changes: 12 additions & 0 deletions swift_vs_objc.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/usr/bin/env bash
    project=.;

    objc=`grep -r "^@implementation " $project | wc -l | tr -d ' '`;
    swift=`grep -r "^class " $project | wc -l | tr -d ' '`;

    ratio=$(bc <<< "scale=3; $swift / $objc");
    ratio_perc=$(bc <<< "$ratio * 100");

    echo "Swift classes: $swift";
    echo "Objective-C classes: $objc";
    printf "Ratio: %0.3g%%\n" $ratio_perc;