AppCode 1.6.3

Hi everyone!

We have a new bugfix update for you today – AppCode 1.6.3. Take a look at the list of fixed issues and grab it while it’s hot!

Use ‘Check for Updates…’ in AppCode’s menu or download the build directly.
Stay tuned for the upcoming AppCode 2.0 EAP, it’s just around the corner!

Yours truly,
AppCode Team

Posted in Announcement | Leave a comment

Live templates: make it snappy!

Take any project, any code, and surely you’ll find a lot of pattern structures like conditionals (if, else), iterations (for), etc. Given the frequency of these structures appearance, typing them mechanically seems to be a huge waste of time that could be used for more creative tasks. Obviously the key factor in making your coding faster and more enjoyable is to spend as little time on routine as possible.

Live templates in AppCode are similar to code snippets in Xcode – they help you to type less and be more productive easily creating and using pattern structures in your code. Live templates contain predefined code fragments so that you can use them to insert frequently-used or custom code constructs into source code quickly, efficiently, and accurately. There are numerous pre-defined templates for Objective-C, JavaScript, CSS, HTML, XSL and some others, however, sometimes it’s not enough. Today we are going to learn how to create custom live templates in order to type less.

Each live template is identified by a template abbreviation. For instance, let’s take a predefined template “Insert alloc and init”. Simply type alloc abbreviation and press Tab. We’ve got complete and valid piece of Objective-C code and the only thing you need to do is to tell what object you are allocating – and we’ve got code completion here.

There are a few types of live templates:

  • Simple template (some fixed code that expands into plain text) Cmd+J
  • Parameterized template (contains plain text and variables that enable user input) Cmd+J
  • Surround templates (for blocks of selected text) Alt+Cmd+T

You can also type template abbreviation and use Tab to make it do coding for you.

Let’s check how can we create a custom template. Just go to Preferences | IDE Settings | Live Templates. You’ll find there a list of predefined Live Templates by groups.

To create your own custom live template, click on add (+) button, or hit Cmd+N:

Enter abbreviation (name by which we are going to invoke this template) and description. After that you need to add Template text (you can also have Template text set for you in case you select a block of text and invoke menu Tools | Save as Live Template). If we are writing Simple Template then just enter text here. For parameterized and surround templates things are a little bit more complicated so we are going to create parameterized template below.

Say, we want to have at hand a pattern for code for converting NSString to NSNumber.

Template variables in live templates enable user input. After a template is expanded, variables appear in the editor as input fields. Variables are declared as $VARIABLE$. They are defined by expressions, and can accept some default values.

Two predefined live template variables are supported: $END$ (position of the cursor after template is expanded) and $SELECTION$ (for surround templates – the code fragment to be wrapped).

To set default values of the variables and set expressions, click Edit variables button.

Don’t forget to define contexts we are going to employ our template.

Now save the template and go to the editor. Enter our custom live template abbreviation stn and press Tab.

Just use code completion to fill in the gaps:

Note that you can jump between the gaps with Tab/Shift+Tab.

You can define as many custom live templates as you need in order to minimize routine coding.

Enjoy!

Posted in Tips'n'Tricks | Tagged | 5 Comments

Local History and TODOs

A few days ago John Lindquist made two screencasts about Local History and TODO features in IntelliJ-based products, which I’d like to share with you, because AppCode is naturally part of IntelliJ family and as such includes this functionality.

Local history
Local History allows to expand VCS functionality for you, or, if you don’t use a version control it’ll help you keep track of everything going on with your code! With all the constant changes made to the code, version control systems can only track differences between committed versions, while local changes can slip unnoticed – and that’s where Local History comes in handy.


Read the related post.

Managing TODOs
TODO comments in the source code help you to keep high performance and have easy access to all the comments and all the places that require further work. It makes navigation faster and work on the code in general becomes more productive and time-efficient.


Read the related post.

Enjoy!

Posted in Tips'n'Tricks | 2 Comments

AppCode is coming to Oslo!

Hey guys!

We’ve got some exciting news! This November we’ll be joining CocoaHeads Oslo meetup and we’ll be presenting AppCode to the local community.

We’ll make an overview of our Objective-C IDE, show what makes it stand out and what is the difference with Xcode, share a whole bunch of tips and tricks about coding productivity, including code completion, generation, navigation, refactorings and so on.

Whether you are an experienced AppCode user, or just tried it a few days ago, I’m sure you’ll learn a thing or two, and definitely won’t leave empty-handed.

So if you are in Oslo area, and are curious about AppCode, feel free to join us and spread the news! We are always happy to meet OS X/iOS developers face-to-face to chat and share ideas.

Date: Thursday, November 22
Location: “The Scotsman”, Karl Johans g 17, 0159 Oslo, Oslo
Sign up for the event here.

See you!

Thanks to CocoaHeads Oslo organisers for inviting us!

Posted in Announcement | 4 Comments

AppCode Code Generation 101

When you’re in the creative mood, developing a new app, or adding cool features to your current one, you definitely don’t want anything to slow you down, right? What probably bugs the most is being stuck by typing each and every thing.

Naturally, there is code completion, but on top of that a lot of code constructs can be simply generated. AppCode comes with a wide set of code generation options, and it would take more than one post to cover them all, but I’d like to make a quick overview of them so you’d get the idea of the power behind it, and we’ll get back to them in detail later.

Intentions

You know why intentional programming is such an awesome thing? I have a simple answer – because we all are lazy, some more, some less. I bet you know how tempting it is to start writing code using methods, classes, variables and whatever else, that doesn’t exist yet. So why holding yourself back?
AppCode lets you be as lazy as you want to. You know those lightbulbs in the gutter area that tell you right away when there’s an error in your code? In fact not only they help you fix problems, but there’s also a whole set of intention actions. Type a name of a method (or a class) that doesn’t exist yet and hit Alt+Enter to create it (or click the lightbulb in the gutter area).

When you generate a method this way and you want it to be declared in a private category, place the caret at method definition and hit Alt+Enter.
That’s not it! Say, you declare a property: hit Alt+Enter and AppCode will synthesize it.
An instance variable needs to be moved to implementation? Alt+Enter
Need getter and setter for a property? Alt+Enter
Flip a binary operation? Alt+Enter
Localize a string? You know the shortcut, right? To see the whole list of available intention actions, just open Preferences | Intentions. Honestly, this shortcut is one of the most important ones, and I can’t stress it enough.

Generate (Cmd+N)

Another way to generate constructs is using Cmd+N (or Code | Generate from the main menu). Here you can choose to create initWith and objectWith methods, declare and synthesize properties, declare members in header file, etc. Most of these things are also available as intentions actions, which one to use is truly more the matter of taste and preference.
By the way, if you invoke Cmd+N from Project View, AppCode suggests you different set of options: you can generate a new class, protocol, category or other file.
Since two of the options are used much more often than others, and I’m talking about “implement/override methods”, they have their own shortcuts to let you reach them even faster: Cmd+I and Cmd+O.

1) Implement methods with Ctrl+I

2) Override methods with Ctrl+O

Surround With

Say, you have an expression or a set of statements you’d like to put inside an “if” statements, what’s the fastest way to do that? First, select what you want to be surrounded with “if”. (Btw, when doing that, try using Alt+Up: with each hit it expands current selection to the next widest token, I’m sure you’re going to love this one.) Now, back to our “if”. Just hit Alt+Cmd+T, and choose “if”.

Whenever you need an “if”, or “for”, @try/@catch, while, (expr), ((Type)expr) or something else – you can add it with Alt+Cmd+T.

Live Templates

Live templates enhance Xcode code snippets by providing more functionality and easier management. Type each and hit Tab to iterate a collection, or logm and Tab to log current method. The whole list of live templates you can find under Preferences | Live Templates, and when you don’t remember the acronym for the construct you need, just press Cmd+J to see the list of suggested templates.
Under Preferences you can even add your own live templates, for example a new “surround with” using $SELECTION$ variable, and it will be available in surround with options when you hit Alt+Cmd+T.

That’s it for today, I hope you’ve learned something new. Stay tuned!

Posted in Tips'n'Tricks | Tagged | Leave a comment

AppCode 1.6.2

Hi everyone!

We have a new update for you today – AppCode 1.6.2. There’s always a way to make things even better! This time we’ve improved LLDB support, Xcode 4.5 compatibility, and fixed a number of critical bugs.

Use ‘Check for Updates…’ in AppCode’s menu or download the build directly.

Thanks everyone for submitting feedback!

Yours truly,
AppCode Team

Posted in Announcement | Leave a comment

Meet us at Macoun!

Good news everyone!

JetBrains will be exhibiting at Macoun, the largest iOS and OS X developers conference in Germany. Macoun is held in Frankfurt am Main, and will take place from the 27th to the 28th of October. We are really excited to meet you guys there, so stop by our booth and have a chat!

We also have 3 free passes for this conference, which we’d love to give to you.
To make things a little bit challenging, we made a short quiz about AppCode. The first three people to give correct answers to 5 questions, will win the passes.

Once again, note that Macoun is held in Frankfurt am Main, Germany.

Good luck!

Posted in Announcement | Leave a comment

Lost in sources? Code navigation to the rescue!

If you ever tried to investigate someone else’s code, you know that efficient project navigation can be crucial. It also comes in handy with your own code as your project grows. Of course, all the projects vary, and every developer has own navigation preferences and habits, so the best way to navigate through the code is a matter of taste; and AppCode gives plenty of choice here: use Go To commands, gutter navigation, special views, quick lookup or usages search. Once you try them, you’ll quickly find your way around. Not to waste your time, let’s drill into details and we’ll start with the essentials.

Go to…

When working on your own project, you often know which file or class you want to open and edit. The fastest way to do this is to use Go to Class… (Cmd+O) or Go to File… (Cmd+Shift+O). No need to type the whole name, just use CamelHumps.

However, as it often happens, you might not remember the whole name of the class or file you’re looking for. No worries, AppCode can match a substring in the search.

If you know precisely, that you want to get to a definition of MyFavoriteVariable, use Go to Symbol (Cmd+Alt+O).

Another important action from the Go to… family is Go to definition. Just place a caret at any symbol, like variable, method, or practically anything, and hit Cmd+B to jump to that symbol’s definition. There’s a little trick here. Say, you have a method (or a class) that has several implementations. Pressing Cmd+B will get you to the first one, however there’s a way to choose a definition you want to navigate to – use Alt+Cmd+B instead.

You can find more options in the Navigate menu. For example, if you have a huge file and you need to navigate to a specific line, press Cmd+L. To navigate between recent files and views use Cmd+E.

Gutter Navigation

Perhaps, you’ve already noticed small icons in the gutter area. They give you another way of navigating through your code, in particular they can be quite useful to navigate through class hierarchy.
With the help of these little icons you can in one click jump to method’s definition or declaration, super methods, overridden methods, go to implementation or super class and much more.

If gutter navigation icons and Go To options are new to you, I definitely recommend giving them a try, because these actions can save you time daily, even hourly.

Navigation Views

To give you a better picture of the structure and hierarchy of your project, AppCode has dedicated views. First of all, it’s the Project View, the main project and project files browser. Another view is called Hierarchy view that allows to see subtypes/supertypes/classes hierarchy and can be invoked from the Navigate menu.
Next one on our list is Structure View: it displays the structure of a file in the current editor tab.
Both Project view and Structure view can also be accessed right from editor using Alt+F1 shortcut. Note, that from this popup you can also reveal current file in Finder.

In addition to the dedicated structure view, you can invoke a lighter version of it right from the editor by pressing Cmd+F12.

Not an obvious thing, but you can filter the results shown in the popup. Just start typing what you’re looking for.

One last hint regarding Navigation views and Go To actions. Maybe you’ve noticed a small icon in the right corner of Go To popups that looks like a magnifying glass. Click it and all the listed suggestions will be opened in the Find view.

This takes us to the next topic – usages search and replacement. However, it deserves special attention and a dedicated post, so stay tuned, we’ll cover it soon!

Enjoy!

Posted in Tips'n'Tricks | Tagged | 4 Comments

AppCode 1.6.1: a perfect environment to plant a seed!

Hello everyone!

I’m pretty sure you’re monitoring the news, and know all about new updates in the industry, so here’s one more update not to miss: AppCode 1.6.1. This fellow is fully compatible with Xcode 4.5 GM Seed, plus comes with a number of fixes: just take a look at the list.

As usual, you can download it from our site or by clicking ‘Check for updates’ in AppCode’s menu.
By the way, if you find yourself missing some features, we’re always glad to read your ideas and suggestions in our discussions forum.

Develop with pleasure!
–The AppCode Team

Posted in Announcement | Leave a comment

Proudly Developed with AppCode

From time to time people ask us “who uses AppCode?” and we are curious about that too. This is exactly why we started a thread on our discussion forum encouraging you to tell us who you are and what awesome apps you develop. We received a lot of good stories and feedback, as well as a great suggestion to provide some kind of a badge that could be added right into your app to show it was made with the help of AppCode.

We thought that was a cool idea, so now we have a special page where you can construct a badge of suitable size and with a text you like: right here.

Feel free to add it to your apps or web pages and keep the story telling going!

If you’re writing about AppCode and need its logo, you can find it here.

Posted in Uncategorized | 2 Comments