GithubHelp home page GithubHelp logo

ltappthinningscript's Introduction

LTAppThinningScript

It's a nodejs script to find unused OC class in iOS

Usage

install nodejs, then run command in terminal

Find Not Import Class By Analyze LinkMap File

Settings to create LinkMap file

Xcode -> Project -> Build Settings -> Write LinkMap File -> YES,

Set "Path to Link Map File" to where you want to create LinkMap file, Default in "~/Library/Developer/Xcode/DerivedData/XXX-eumsvrzbvgfofvbfsoqokmjprvuh/Build/Intermediates/XXX.build/Debug-iphoneos/XXX.build/"

Xcode -> Build

Run command

node linkmap_ext.js filepath -hl

node linkmap_ext.js filepath -u

-h: format size

-l: stat libs

-u: stat unused class

filePath refers to the path of the link map file.

like this:

node linkmap_ext.js /Users/xxx/Downloads/script/linkMap.txt -u

New Added - Find Unused Import Files

linkmap_ext command can help you find out the unimport files, if you want to find unused import files use below command

Run command

node unused_import.js filepath

(now it only can find unused import files in one file)

like this:

node unused_import.js /Users/xxx/Downloads/LTSampleViewController.m

output:

WSSampleModule.h

NSString+Additions.h

WSSampleTestViewController.h

These files is imported in LTSampleViewController, but may not used in this file.

Note that some files you may use, like 'NSString+Additions.h', so be careful when you delete it

ltappthinningscript's People

Contributors

alicialy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ltappthinningscript's Issues

how to identify which function is unused?

To prove your script's integrity, i create a very simple swift project with two function, one is unused, one is called in viewDidLoad function.

I don't see too much differences from the output of result:

node linkmap_ext.js /Users/jacob/Library/Developer/Xcode/DerivedData/jkdf-bctycnfuafksiycxbakxucloeviq/Build/Intermediates/jkdf.build/Debug-iphonesimulator/jkdf.build/jkdf-LinkMap-normal-x86_64.txt -hu
AppDelegate.o 15.00KB
ViewController.o 2.67KB
jkdf.app.xcent 378B
libswiftCore.dylib 312B
libobjc.dylib 144B
libswiftFoundation.dylib 72B
libswiftObjectiveC.dylib 24B
UIKit 24B
libSystem.dylib 24B
Foundation 24B
linker synthesized 0B

LMXMN024:LTAppThinningScript jacob$ node linkmap_ext.js /Users/jacob/Library/Developer/Xcode/DerivedData/jkdf-bctycnfuafksiycxbakxucloeviq/Build/Intermediates/jkdf.build/Debug-iphonesimulator/jkdf.build/jkdf-LinkMap-normal-x86_64.txt -hu
AppDelegate.o 15.00KB
ViewController.o 3.26KB
libswiftCore.dylib 408B
jkdf.app.xcent 378B
libobjc.dylib 144B
libswiftFoundation.dylib 72B
libSystem.dylib 24B
libswiftSwiftOnoneSupport.dylib 24B
libswiftObjectiveC.dylib 24B
Foundation 24B
UIKit 24B
linker synthesized 0B

ViewController.o 2.67KB
increase to
ViewController.o 3.26KB

but which function is unused? should i look into the linkMap again?
Your help is much appriciated.

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.