Welcome to Slender, we are excited you are here. Slender is a developer and designer tool to assist you in making sure your asset usage remains in check as well as to detect any potential errors that may be encountered. Slender works with Xcode Projects (iOS and Mac), Web Projects (PHP, JavaScript, Rails, and many more), and raw images (designer exports). By using various algorithms and detection methods Slender can provide a relatively accurate look at your project.
Before diving into specific help topics it is important to understand the limitations of Slender. Slender uses static code analyst to determine how your project is using assets. This has several flaws that may result in inaccurate results, and as we have learned, everyone codes differently and trying to support all styles is a very difficult task. If you encounter an error in results, please send us additional information at support@martiancraft.com
Slender has three scanning methods all of which are on by default, these methods will have various levels of accuracy associated with them. You can turn on or off various scanning methods through Preferences.
Static Detection is the default scan method of Slender and cannot be turned off. Static detection scanning will search through all associated source code files and present interface builder files looking for explicit references to image names. Static Detection should be completely accurate and 'Used In' results should be trustworthy.
Dynamic Detection will scan through a project looking for constructed image names. Often time developers generate strings on the fly based on loops or other input. This results in images being referenced in ways that are not directly detectable. Slender will also ignore overly broad Dynamic usages such as [UIImage imageNamed:@"%@", imageVariable]]. A careful balance has been struck with determining proper Dynamic references, however if a usage reference seems suspect it warrants additional followup.
Fuzzy Detection is the more error prone usage detection system in Slender. Fuzzy Detection will look for a Static or Dynamic reference anywhere in the project (outside of comments). This will catch instances where image names are being returned through method calls but will also improperly flag NSLogs of image names as valid usages. We recommend that all Fuzzy references been examined individually for proper usage. It may also be helpful to disable Fuzzy Detection in the preferences if the results are too error prone for your project or code style. If this is the case, we would really be grateful if you sent us a sample project we could analyze.
Slender will detect several different types of errors in the process of scanning for asset usage.
A copy of the non-retina image could not be found and should be added to the project.
No retina image was detected. Retina images are required for iOS projects and recommended for Mac and Web projects.
Applies to Xcode projects only. With Asset Catalogs, certain groups can now include @1x, @2x as well as R4 (Retina 4") images. This alerts appears if a set is missing the 4" version.
The retina image is not exactly double the dimensions of the non-retina image.
The retina image has odd dimensions which means that it cannot possibly be double the dimensions of a non-retina. This alert only appears if the image is also a missing its @1x counterpart.
This exact image appears elsewhere in the project with a different file name (or file names).
The file shares the same name as another file which may produce unexpected results. This alert is aware of localized files and will handle them in an expected fashion.
The Color Profile of the images do not match.
Applies to Xcode projects only. The file is being referenced in the Xcode project but does not exist in the Finder. This is typically represented by a red file name in the Xcode file browser.
When Slender is launched you will be presented with a drop window. From here recent projects can be accessed or new projects can be dropped onto it. Simply drag and drop a project folder onto Slender or use the "Locate in Finder" button. Once a project has been selected, scanning will begin. Depending on the size of the project and the speed of the computer running Slender, it may take from a couple of seconds to several minutes for a scan to complete. Once a scan has completed, the full results will be displayed in Slender's results window.
On the left hand side of the results window you are presented with a project list. This list will contain all of the sub-projects found within the folder that was dropped onto the main window. You may also drag and drop or use the +/- buttons at anytime to add or remove projects from this list. Web and Xcode projects feature a drop down list. Each target in the project will be listed, and include another drop down list which will display all of the source files contained in a project. If the project or source file name is a light grey it contains no image references. If the project has only one target, the targets will be omitted. Selecting a project will display a list of all used and unused assets for that project. Selecting a target will display a list of all used and unused assets included in that specific target. While selecting a source file will only display the images used by that file.
Slender features several methods of filtering in addition to project and source file selection covered in the previous section. The first methods are the buttons located above the displayed results. These filter the results displayed to show you 'all' files, only 'unused' files, or files with 'alerts' and warnings. Additionally the upper right of the results window features a search box that will filter the displayed results further, by matching text in the 'Used In' or 'Name' columns. Each column in Slender can also be sorted by clicking on its header.
Each row of the results table represents one asset, in the case of retina assets, they are combined with their @1x counterpart in a single row. The thumbnail icon can be clicked to invoke Quick Look on an asset. Under the thumbnail icon the dimensions are displayed (in points). In the 'Used In' column a list of files that reference the given asset are displayed, this can be expanded by clicking the "Show X More" button if applicable. Clicking on a file name in the 'Used In' column will display the line of text that referenced the asset. The alerts column displays any detected problems with the asset, clicking on an alert will reveal more information about the problem.
Slender now has the capability to analyze and display Asset Catalogs. Slender groups related images together for easy access. To display the contents of the Catalog simply click on the triangle to the left of the image’s icon and the image sets will be displayed in smaller sub-rows.
The info panel will automatically present itself upon selection of a row in the results (unless you have previously closed it). The info panel can be dragged up from the bottom of the results window at anytime rows are selected. The info window contains additional information about the selected asset(s), and provides additional actions you can perform on the selected asset(s). Note that selecting a row will show you details of all of the images in that row. You can also tap a single file to view the details specific to that file.
In addition to clicking on an icon in the results window the spacebar can also be used to invoke Quick Look on the selected asset(s).
Each 'Used In' reference features a small arrow directly to the right of the name, clicking on the arrow will open up to the referenced line number in Xcode, or in the case of a Xib or Storyboard will display the file. Since Xcode doesn't allow third party interaction, the results of this action may occasionally be less than ideal. At this time there is no support to have files open up in apps other than Xcode.
The generate report functionality is invoked either through the menu or the button directly over the project list. This can be used to compile customized PDF reports on the usage and errors of a project. These reports can be directly handed to a designer to make corrections. When generating a report you are presented with options to configure which topics the report should cover. Reports can only be generated for one project or one target at a time.
The compress option will run various image compression algorithms on assets, you will be presented with a compression window with previews on what the compressed image will look like as well as information on the amount of space saved.
Whitelisting will mark the asset as used in your project and prevent it from triggering an unused alert. A new .slender file will be created in your project folder that can be committed into version control so other team members see the same whitelisted items. To remove a whitelisted item select it in Slender's results window and click on the 'Remove from Whitelist' button.
Unlinking will remove the selected asset(s) from the selected project. If you're working with an Xcode project, Slender will delete the assets and rewrite the project file to remove their references. If you have a target selected in the project list, Slender will unlink the asset from that target only. In the case of a web project it will simply delete the file from the project structure. All changes will be saved into a Slender Backup folder located in the root of the project. If your project is under version control, you may not need Slender to make backups and so a preference is available to disable backups.
When using Quick Look or revealing an asset in the Finder, holding down the option key will reveal or Quick Look the retina version of that file.
Right clicking on an asset in the results table will bring up options to reveal the asset in finder, reveal the source in finder, reveal the project in the finder, or mark the asset as a project icon (see below).
When generating a report for a project, Slender will use your project's icons to personalize the report. If your project is an Xcode project, Slender can often detect the icon automatically. For web or image projects (or if Slender picks the wrong image in your Xcode project), you can indicate which files to use as icons by control-clicking the asset in the results window and selecting 'Use as a Project Icon'. Remove an asset by selecting 'Stop Using as a Project Icon'. You can mark multiple files as project icons and Slender will use the most appropriate size in the report.
Slender can be passed an optional command line argument to initiate a scan of a path using the format "-scan ${PATH}". You can easily add a build phase in your Xcode project to automatically run a Slender scan. In Xcode, select a target, click the "Build Phases" tab, and then "Add Build Phase". Choose "Add Run Script". A new run script phase will appear. Leave the shell set to its default setting, and enter "open /Applications/Slender.app/ --args -scan ${PROJECT_DIR}" as the script.