Xcode's handy plugins and third-party

Source: Internet
Author: User
Tags imageoptim

Copyright notice

This article is starting in the June 2014 issue of "Programmer" magazine, please do not reprint without permission.

Objective

From Apple's invention of the IPhone, one of the stories on AppStore, like Flappy Bird, has stimulated a large number of developers to join the mobile development army. As these developers emerge, there are a number of tools that are handy for iOS developers. These tools, as an important link in the entire application development ecosystem, greatly facilitate the application developers and save time for application development.

This article will introduce these excellent applications from 3 aspects of application tools, command line tools, and plug-in tools.

Graphical Application Tools Charles

Charles (http://www.charlesproxy.com) is a common tool for intercepting network packets under MAC, and when doing iOS development, we often need to intercept network packets for debugging and server-side network communication protocols. By setting himself up as a network Access Proxy for the system, Charles enables all network access requests to be done through it, enabling the interception and analysis of network packets.

Charles detailed instructions for use, welcome to read my article: "IOS Development tools-Network packet analysis tool Charles"

Interface debugging

Ponydebugger (Https://github.com/square/PonyDebugger), Reveal (http://revealapp.com/), Spark Inspector (HTTP/ sparkinspector.com/) is the three commonly used interface debugging tools to dynamically debug the IOS app interface while the program is running. Ponydebugger is free and open-source, and the latter is charged, but more powerful.

For dynamic or complex interactive interfaces, the handwriting UI is unavoidable, and the Reveal class of tools allows us to see whether the corresponding properties of the control are normal, and to dynamically modify the interface elements while the program is running. So you don't have to change the code and restart the program again and again.

Xscope

Xscope (http://xscopeapp.com/) is a kind of tool set related to interface development. For IOS Development, the more useful features include its Magnifier Color tool, ruler tool, and more. The magnifying glass tool can collect multiple color sets to facilitate subsequent use, and support paste directly into the relevant program color code.

Xscope is a paid software, and there are some limitations on the features of the unpaid version.

Imageoptim

Imageoptim (http://imageoptim.com/) is a free tool for image compression. IOS works by default uses the Pngcrush command to compress the picture, but its compression ratio is not really high. For readers with more picture resources in the app, try using Imageoptim to achieve maximum image compression.

If you have never tried the Imageoptim type of image compression tool, then the first time to the IPA file slimming effect should be more amazing. My personal experience is that imageoptim can reduce the use of at least 10% of the application's image resources for the first time.

The principle of imageoptim is to use a variety of open source image compression tools, and then take the one that works best. The tools it tries include: PNGOut, Zopfli, Pngcrush, Advpng, extended optipng, Jpegoptim, Jpegrescan, Jpegtran and Gifsicle.

The installation method is to download the program files from its official website (http://imageoptim.com/) and drag them to the "Applications" directory. This article is all the mapping, you can see the use of Imageoptim to achieve a 29.5% reduction in volume.

Mark Eel

Mark Eel (http://www.getmarkman.com/) is a free labeling tool developed by the Chinese, which can conveniently mark the size, color, margin and description of the corresponding interface elements in the art output design manuscript.

Command-line tools Cocoapods

As each language develops to a single stage, the corresponding dependency management tool or central code repository appears. such as the Java Maven,nodejs of NPM and so on. CocoaPods (http://cocoapods.org/) is a tool that provides dependency management for IOS programs. Developing IOS projects inevitably uses third-party open source libraries, and the advent of CocoaPods allows us to save time setting up and updating third-party open source libraries.

When I developed the Ape Bank client, it used 24 third-party open source libraries. Before using CocoaPods, I need to:

    1. Copy the source code files of these third-party open source libraries into your project, or set them as Git submodule.
    2. For these open-source libraries, which usually depend on some of the framework of the system, I need to manually add these framework one by one to the project dependencies, for example, a network library will need to add the following framework:cfnetwork as usual. SystemConfiguration, Mobilecoreservices, Coregraphics, zlib.
    3. For some open source libraries, I also need to set -licucore or -fno-objc-arc wait for compilation parameters
    4. Manage updates for these dependent packages.

These physical activities, though simple, have no technical content and waste time. After using CocoaPods, I only need to put the third-party open Source Library in a file named Podfile, and then execute it pod install . CocoaPods will automatically download the source code of these third-party open source libraries and set up the corresponding system dependencies and compilation parameters for my project.

There are a few things to keep in mind when using CocoaPods:

    1. You need to use the. xcworkspace file generated by CocoaPods to open the project instead of the previous. xcodeproj file.
    2. Each time you change the Podfile file, you need to execute the pod update command again.
    3. When you do pod install , in addition to Podfile, CocoaPods will also generate a file named Podfile.lock , you should add this file to version management. Because Podfile.lock locks the version of the current dependent library, it will change if the pod install version is not changed after multiple executions pod update Podfile.lock . The advantage is that when multiple people collaborate, you can ensure that everyone's third library environment is exactly the same.

Detailed instructions for use, welcome to read my article: "Using CocoaPods to do IOS program dependency Management"

Nomad

Nomad (http://nomad-cli.com/) is a handy command-line tool for you to operate Apple Developer Center, including the convenience of adding test devices, updating certificate files, adding App IDs, verifying IAP Credentials, and so on.

Installation method:

1
gem install nomad-cli

After the installation, the first execution ios login , your Developer account password will be stored in the Keychain, then you can use the command line to complete a variety of background operations, such as:

To add a test device:

1
ios devices:add "TangQiaos iPhone"=<Device Identifier>

Update the certificate file:

1
ios profiles:devices:add TangQiao_Profile "TangQiaos iPhone"=<Device Identifier>

Nomad also has a number of features that suggest you read the documentation on its official website for further study.

Xctool

Xctool (Https://github.com/facebook/xctool) is Facebook's open source, an IOS compilation and testing tool. Using it instead of using Xcode's UI interface is because it is a pure command-line tool. For example, we can use Xctool to compile and unit test the commands, and then integrate the test results into Jenkins, which enables automated continuous integration. Although Apple also launched its own automated integration tool BOT on OSX Server, its configuration and use are still not very convenient.

To install Xctool, you can use the Brew command:

1
brew install xctool

To compile a project using Xctool, you can use the following command:

1234  
path/to/xctool.sh   -project YourProject.xcodeproj   -scheme YourScheme   build

To perform unit tests using Xctool, you can use the following command:

1234  
path/to/xctool.sh   -workspace YourWorkspace.xcworkspace   -scheme YourScheme   test

Xctool also has a lot of features, it is recommended that you read the Xctool official website to learn more about the features.

Appledoc

Appledoc (Https://github.com/tomaz/appledoc) is a tool for extracting documents from source code.

For developers, the document is best and source together, so the update is more convenient and handy. A language like Java itself comes with the Javadoc command, which extracts documents from the source code. Appledoc is a Javadoc-like command-line program that extracts the appropriate annotations from the source code of the IOS project to generate the help documentation.

Compared to other document generation tools, the advantages of Appledoc are:

    • Its default generated document style is consistent with Apple's official documentation.
    • Appledoc is written with objective-c, the necessary time to debug and change is also more convenient.
    • It can generate docset and integrate into Xcode. After integration, you can bring up the relevant help document by holding down option and clicking it at the appropriate API call.
    • It has no special annotation requirements and is highly compatible.

To install Appledoc, you can use the Brew command directly:

1
brew install appledoc

When you switch to the IOS project directory, do the following, Appledoc scans all files under the current path, and then generates a good document to be placed in the doc directory. You can also use Appledoc-help to view all available parameters.

123 
appledoc -o <output_path> --project-name <project_name> --project-company <project_company> .

Detailed usage Introduction, welcome to read my article: "Document Generation tool using Objective-c: Appledoc"

Xcode Plugin

Xcode is an integrated development environment for IOS, and while Apple has been constantly improving xcode, programmers always have a variety of new ideas and needs that, when Xcode doesn't meet them, will add functionality to Xcode through plugins. This section will introduce you to some commonly used Xcode enhancement plugins.

Xcode all the plugins are installed in the directory ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/ , each plugin is a subdirectory, you can also manually switch to this directory to add or remove plugins.

Alcatraz

Alcatraz (http://alcatraz.io/) is a plugin that manages all of Xcode's plugins, which can be integrated directly into Xcode's graphical interface, making you feel like you're using Xcode's own functionality. Alcatraz not only manages Xcode's plugins, it also provides the ability to manage Xcode engineering templates as well as color configuration.

Use the following command line to install Alcatraz:

123)45   
mkdir -p ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins;curl -L http://git.io/lOQWeA | tar xvz -C ~/Library/Application\ Support/ Developer/Shared/Xcode/Plug-ins

If you restart Xcode after successful installation, you can find Alcatraz in "window" –> "package Manager" in the top menu of Xcode. Click "Package Manager" to launch the plugin list page. You can search the plugin in the upper right corner, for the plugin you want to install, click on the icon to the left to download the installation, as shown below, I am installing the kimagenamed plugin:

Once the installation is complete, click the icon to the left of the plugin again to remove the plugin.

All of the following plug-ins can be installed or deleted by this method, and will not be introduced separately.

Alcatraz Detailed usage Introduction, welcome to read my article: "Use Alcatraz to manage Xcode plugin"

After installing the XCODE7, continue to use the official method to install Alcatraz, found unsuccessful. Installing Xvim separately is also unsuccessful. Looked at Alcatraz's issues, found the solution, the record is as follows, hoping to help the people in need.

First step: Turn off Xcode.
Step two: If you have previously installed Alcatraz, uninstall it. To run the command:

~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin

Step three: The most critical step is to run the command:

find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUIDsudo xcode-select --reset

Fourth step: Open Xcode.
Fifth step: Install Alcatraz.

https://raw.github.com/supermarin/Alcatraz/master/Scripts/install.sh | sh

Sixth step: Restart Xcode.

I use the method above, and then install Xvim in the Alcatraz is also operating normally

Ksimagenamed

Ksimagenamed (Https://github.com/ksuther/KSImageNamed-Xcode) is a plug-in that helps you enter a resource name in [UIImage imagenamed:]. When you type [UIImage imageNamed:] , it will automatically pop up the context menu, for you to choose the name of the image resource you need to enter, and in addition to the image resource, you can also preview the resource on the left. As shown in the following:

Xvim

Xvim (Https://github.com/JugglerShu/XVim) is a Xcode vim plugin that lets you turn on Vim mode in the Xcode editing window.

The biggest benefit of Vim mode is that you can easily move the cursor and copy and paste the code with full keyboard operation. Xvim also has a good support for Xcode's column mode, and as with Vim's own column mode, you can use the shortcut keys ctrl + w to toggle the currently edited column.

Fuzzyautocompleteplugin

Fuzzyautocompleteplugin (Https://github.com/FuzzyAutocomplete/FuzzyAutocompletePlugin) allows for automatic code completion using a fuzzy approach.

For example, if we are going to overload the viewDidAppear: method, then we have to build the view, did, appear in order to get the corresponding completion information, after using Fuzzyautocompleteplugin, we can build the VDA (view, did, appear The first letter of the three words), or any substring that matches the order in which the entire word appears viewdidappear (such as Vdapp, adear, etc.), can be matched to the method.

Xtodo

Xtodo (https://github.com/trawor/XToDo) is a lookup item in all of the TODO annotations with,,, FIXME ??? !!! tags.

Usually we are in the project development, for a variety of reasons, some things need to be dealt with later, this time to prevent forgetting, plus TODO or comment is very FIXME necessary, but to go online or submit code before the search for these unresolved issues is slightly troublesome. Xtodo can provide a summary of the interface, showing all the unfinished TODO and FIXME marked.

Bbudebuggertuckaway

Bbudebuggertuckaway (Https://github.com/neonichu/BBUDebuggerTuckAway) is a very small tool that can automatically hide the debug window at the bottom when you edit the code. Because normally, debugging is the time to add breakpoints or monitor variable changes, or in the Console window po to output some debugging information. If you start to edit the code, the explanation has been debugging the end, this time to hide the debugging window, you can give the editing interface more space, so that we modify the code.

Scxcodeswitchexpander

Scxcodeswitchexpander (Https://github.com/stefanceriu/SCXcodeSwitchExpander) helps you quickly populate the switch statements with each possible value of an enumeration type.

For example, when you enter and switch then type a NSTableViewAnimationOptions class, the plug-in complements its possible values after each one case , as shown in:

Deriveddata-exterminator

Deriveddata-exterminator (https://github.com/kattrali/deriveddata-exterminator) is a plugin that clears the Xcode cache directory.

Sometimes Xcode has a variety of strange problems, most often in some complex operations (such as the same project, back and forth to various branch versions), will cause Xcode to display some compile errors or warnings, but eventually can be compiled through. Novice users are often overwhelmed by this problem, and people familiar with Xcode know that it is often possible to clear the Xcode cache to solve such problems. The plugin adds a clear cache button on the Xcode menu, allowing you to clearly cache content with one click.

Vvdocumenter

Vvdocumenter (Https://github.com/onevcat/VVDocumenter-Xcode) is a tool that automatically generates code comments that can easily extract the parameter names and return values of a function, in combination with the one described in the previous section. appledoc command, you can easily export the help document.

Clangformat

Clangformat (Https://github.com/travisjeffery/ClangFormat-Xcode) is a tool that automatically adjusts code style. Xcode's own code indentation auto-tuning feature is weak, especially in JSON format, which often produces very ugly default indentation effects. Clangformat-xcode can re-typeset the code better, with a built-in layout style and support for custom styles.

Colorsense

Colorsense (Https://github.com/omz/ColorSense-for-Xcode) is a UIColor color input helper that helps you to UIColor preview the appropriate color in real time when writing code, as shown in:

Xcodeboost

Xcodeboost (Https://github.com/fortinmike/XcodeBoost) contains several small functions that assist in modifying the code, such as:

    • You can copy the method implementation in the. m file, and then paste the definition of the method into the corresponding. h file
    • You can enter a regular expression lookup directly in a source file
    • You can copy and paste the code without the automatic indent feature of Xcode (Xcode's auto indent often goes wrong, causing the adjusted code to indent because it was tweaked by Xcode when pasting)

Xcode's handy plugins and third-party

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.