Making Xcode a bit more efficient

    Software development is a very interesting process that we all really, really like, but there are some things that are too monotonous. Today I would like to talk about how I simplified my workflow in Xcode using various third-party plugins.

    Integration :)

    I ask those interested

    Where do we start?

    I advise you to start by installing the package manager for Xcode - Alcatraz . You can install it by running just one command in
    curl -fsSL | sh

    So, restart Xcode, click Window-> Package Manager. Now we have a UI for managing our plugins. Already good (terminal lovers can continue to do everything through the console).

    Alcatraz Window


    Importing files into Objective-C is a rather tedious operation. Imagine the situation: you are somewhere knee-deep in the code, and here you need to import another class. You scroll to the very top * .m file or go to * .h. After that write # import ... and go back.

    To solve this problem, just install the Auto-Importer plugin . We restart Xcode, start introducing a class that has not yet been imported, press Ctrl + Cmd + H, voila:

    Now just hit Return and the class is imported. In my opinion, this is very cool.

    Tired of black?

    The console is a powerful tool for debugging, but there is always a lack of the ability to somehow highlight very important messages. The XcodeColors plugin will help us with this , which will add colors to the output:

    As you can see in the screenshot, I highlighted the requests sent from the application in blue (implemented through NSURLProtocol. If anyone is interested how to implement this, write, I will make a separate post), and highlighted in red not processed SSE events.

    To do this, just install the plugin and add the line to your * .pch file:
    #define LogRed(frmt, ...) NSLog((XCODE_COLORS_ESCAPE @"fg255,0,0;" frmt XCODE_COLORS_RESET), ##__VA_ARGS__)

    As you can see from the code:
    255,0,0 - RGB colors (you can even draw a rainbow in the console, if you try)
    LogRed is just a define to do red logs in the future

    As a result, we have:
    LogRed(@"My string: %@", string);

    For a snack

    It turned out to be very convenient a set of extensions for Quick Look , which allow you to immediately format JSON, display image size, add syntax highlighting and much more.

    I hope that the post was useful and I did not waste your valuable time. I will be happy to answer any questions in the comments.

    Also popular now: