Command line program that detects unused resource strings in an iOS or OS X application.

Overview

Abandoned Resource String Detection

This command line program detects unused resource strings in an iOS or OS X application.

Updated to Swift 3, thanks to @astaeck on Oct-17-2016

Usage

Open a Terminal to the directory which contains the AbandonedStrings executable, and run the following command:

$ ./AbandonedStrings /Users/your-username/path/to/source/code

What to expect

If a .strings file contains…

"some_string_identifier" = "Some Display Text";

…this program will consider that resource string to be abandoned if…

"some_string_identifier"

…is not found in any of the source code files (namely, files with a .h, .m, .swift or .jsbundle extension).

More details

This program searches through the source code files in an iOS app project, looking for resource strings (in a .strings file) whose identifiers are not referenced by the application's source code.

The search logic does not take into account if code is commented out, so it won't be as reliable if your application has a lot of commented-out code.

It also does not try to determine the context in which string identifiers are used, such as whether or not the string is being used to look up a localized string value or if it just happens to match a resource string identifier by coincidence.

Also, this program is ineffective if resource string identifiers are referenced via constants or dynamically constructed.

Disclaimer

As noted above, this program uses a simple heuristic and is not guaranteed to produce perfect results for every codebase.

Comments
  • Updated to Swift 3 and added Storyboard as optional argument

    Updated to Swift 3 and added Storyboard as optional argument

    This pull request converts the project to the latest Swift 3 version. Furthermore it adds the possibility to enter "storyboard" as last optional command line argument to enable also the search for identifiers which are used inside the visual files. You can also add more root directory paths.

    opened by astaeck 2
  • Executable main.swift

    Executable main.swift

    You're a gentleman & a scholar - thanks for the great tool!

    This PR:

    • makes main.swift executable
    • allows for running from the command line per the docs (for those not used to running swift that way)

    🍻

    opened by sterlingwes 1
  • Parallelize + add

    Parallelize + add "write" option

    Hi there, thanks for making this! It was missing 2 things I needed:

    1. it was really slow (I have a large source-base), because it was confined to one thread. It is now parallelized so you can use all your CPU cores
    2. I want this to (destructively) modify my strings files, so I added a "write" parameter. If "write" is present, it'll update the strings files. I made separate commits for (1) and (2). All the best -tim
    opened by xaphod 1
  • No results when '.strings' files are not UTF8 encoded

    No results when '.strings' files are not UTF8 encoded

    Don't know if you've had this problem, but I got no results running abandoned-strings on my source. Turned out it was thecontentsOfFile method failing due to the encoding of the .strings files not being UTF8 encoded. I changed the method thusly to fix it.

    func contentsOfFile(filePath: String) -> String {
        do {
            let usedEncoding = UnsafeMutablePointer<NSStringEncoding>()
            return try String(contentsOfFile: filePath, usedEncoding: usedEncoding)
        }
        catch { return "" }
    }
    
    opened by adambolcsfoldi 1
  • String(contentsOfFile: filePath) failed : couldn’t be opened because you don’t have permission to view it.

    String(contentsOfFile: filePath) failed : couldn’t be opened because you don’t have permission to view it.

    Searching for abandoned resource strings… cannot read file!!! : Error Domain=NSCocoaErrorDomain Code=257 "The file “xxxx” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/Users/myname/Documents/MyProject/Pods/xxxxxx.swift, NSUnderlyingError=0x7f8afd9f3e10 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}

    I tryid every thing I could think of : chmod X on AbandonString.swift chmod -R 777 on project folder and execute command with "sudo"

    🤷‍♂️

    Thanks for help.

    opened by vassily-fr 0
  • Upgrade codebase to Swift 5

    Upgrade codebase to Swift 5

    Changes:

    • Updated project.pbxproj to SWIFT_VERSION 5.0
    • Fixed compiler warnings for Swift 5
    • Updated project.pbxproj to recommended project settings

    Prerequisites for solving: #15

    opened by anhar 0
  • Crash due to force unwrapping

    Crash due to force unwrapping

    Seeing quite a few crashes here: let endIndex = lineWithoutFirstQuote.index(of:"\"")!

    It would be best to remove all force unwrapping and make functions like extractStringIdentifierFromTrimmedLine return optional strings.

    opened by chaseacton 0
Owner
Josh Smith
Josh Smith
All new design. Inspect your iOS application at runtime.

Peek: All new design Peek 5 with an all new design and all new features. Whether you're a developer, designer or QA/tester, Peek can help you at all s

Shaps 2.6k Dec 17, 2022
Shows your current framerate (fps) in the status bar of your iOS app

WatchdogInspector Shows your current framerate (fps) in the status bar of your iOS app Be a good citizen! Don't block your main thread! WatchdogInspec

Christian Menschel 510 Nov 24, 2022
An iOS app decrypter, full static using fouldecrypt.

Iridium An iOS app decrypter, full static using fouldecrypt. Supporting iOS 13+ Note We have built everything into the package, you can install and fl

Lakr Aream 234 Jan 9, 2023
An iOS app decrypter, full static using fouldecrypt.

Iridium An iOS app decrypter, full static using fouldecrypt. Supporting iOS 13+ Note We have built everything into the package, you can install and fl

Lakr Aream 226 Dec 24, 2022
Build native iOS, Android, and Web apps with Capacitor and Remix.run 💿

This repository holds production ready Capacitor templates for building native mobile applications using Remix. Using Capacitor, you can quickly build out a native mobile application for iOS and Android using web technology, such as Remix.

Ionic 70 Dec 30, 2022
How to use swiftlint to identify unused code or unused imports in a Swift codebase

Swift compilation database This repository demonstrates how to use swiftlint to identify unused code or unused imports in a Swift codebase. How to run

Andrés Cecilia Luque 3 Aug 26, 2022
🌊 A clean wave - report unused localized strings

Ripple ?? Ripple - a command line tool that reports unused localization strings in your Xcode project. Install Clone from repo git clone cd Ripple sw

Edoardo Benissimo 3 Sep 16, 2022
Validate iOS, Android, and Mac localizations. Find errors in .strings, .stringsdict, and strings.xml files.

Locheck An Xcode and Android localization file validator. Make sure your .strings, .stringsdict, and strings.xml files do not have any errors! What do

Asana 73 Dec 13, 2022
JSONHelper - ✌ Convert anything into anything in one operation; JSON data into class instances, hex strings into UIColor/NSColor, y/n strings to booleans, arrays and dictionaries of these; anything you can make sense of!

JSONHelper Convert anything into anything in one operation; hex strings into UIColor/NSColor, JSON strings into class instances, y/n strings to boolea

Baris Sencan 788 Jul 19, 2022
The Big List of Naughty Strings is a list of strings which have a high probability of causing issues when used as user-input data.

The Big List of Naughty Strings is a list of strings which have a high probability of causing issues when used as user-input data. I have put together

Romain Pouclet 589 Sep 7, 2022
Resource monitor - A flutter plugin for Android and IOS to monitor CPU and RAM usage of device.

resource_monitor A flutter plugin for Android and IOS to monitor CPU and RAM usage of device. TODO Implement Android Side of this plugin. Add listener

Skandar Munir 1 Nov 11, 2022
Respresso is a centralized resource manager for shared Android, iOS and Web frontend projects

Introduction Respresso is a centralized resource manager for shared Android, iOS and Web frontend projects. It allows you to simply import the latest

Respresso 10 Nov 8, 2022
A CLI tool for localization resource management on Xcode. Built with Google Translator.

Supported by Jetbrains Open Source License Program Automatically translate and synchronize '.strings' files from the defined base language The basic c

gitmerge 164 May 4, 2022
A resource based, protocol oriented networking library designed for pure-SwiftUI applications.

Monarch ?? - WIP A resource based, protocol oriented networking library designed for pure-SwiftUI applications. Features: Async/Await Resource Based P

Emilio Pelaez Romero 4 Oct 17, 2022
Vitals - A tiny macOS process monitor lives in the menu bar, keeping track of resource usage

Vitals lives in the menu bar, keeping track of resource usage in the background so you can summon it instantly at any time.

Harry Marr 392 Dec 17, 2022
iOS app that detects LaTeX symbols from drawings. Built using PencilKit, SwiftUI, Combine and CoreML for iOS 14 and macOS 11.

DeTeXt Finding the symbol you want to use in LaTeX can be hard since you can't memorize all the possible commands and packages for every symbol you mi

Venkat 73 Dec 8, 2022
An iOS framework that uses the front camera, detects your face and takes a selfie.

TakeASelfie An iOS framework that uses the front camera, detects your face and takes a selfie. This api opens the front camera and draws an green oval

Abdullah Selek 37 Jan 3, 2023
An iOS app 📱that detects the image and plays video on top of it just like the harry potter movies

AR-Magic-Image This is an iOS application ?? inspired from Harry Potter movies. It tracks the image and plays the assigned video on top of the image u

Vatsal Patel 4 Dec 17, 2022
A tool for finding missing and unused NSLocalizedStrings

nslocalizer This is a command line tool that is used for discovering missing and unused localization strings in Xcode projects. Contributing and Code

Samantha Demi 155 Sep 17, 2022
A CoreML models that detects nudity in a picture

Nudity Detection for CoreML Description This is the OpenNSFW dataset implemented in Apple's new framework called CoreML. The OpenNSFW dataset can pred

Philipp Gabriel 99 Oct 13, 2022