AppCode 2018.1 Help

Quick Start Guide

This Quick Start Guide is designed to introduce the key AppCode concepts and help you quickly get started with the IDE.

Step 0. Before you start

Do I need Xcode at all?

Yes, you do. AppCode will not run without Xcode available.

Which version of Xcode should be installed?

Please, check the Installation Requirements section above.

Can I use both AppCode and Xcode at the same time?

AppCode uses the same project model and project file, and synchronizes all changes with Xcode. You can work simultaneously in both IDEs, make changes and jump back and forth – AppCode will make sure that everything is synchronized and up to date.

Is AppCode macOS only?

Yes, because AppCode needs Xcode and Xcode runs on macOS.

Will I be able to work with my project in Xcode after I edit it in AppCode?

Yes, AppCode uses the same project model as Xcode.

Step 1. Open/Create a project in AppCode

Open an existing project

Begin by opening one of your existing projects stored on your computer. You can do this right from the Welcome screen: just click Open Project, and locate the xcodeproj or xcworkspace file:

ac QSG Create

AppCode is fully compatible with Xcode: it uses the same project model and project file, and synchronizes all changes with Xcode. You can work simultaneously in both IDEs, make changes and jump back and forth – AppCode will make sure that everything is synchronized and up to date.

Check out an existing project from Version Control

You can also download sources from a VCS storage or repository. Choose Git, GitHub, CVS, Mercurial, Subversion, Perforce or TFS, and then enter your credentials to access the storage. Then, enter a path to the sources and clone the repository to the local host:

ac QSG CloneRepo

Create new project

ac QSG CreateNew
AppCode supports all Xcode templates, so you can create new projects the same way you do in Xcode.

Step 2. Look around

When a project is opened, you see the main window divided into several logical areas. Let’s take a moment to see the key UI elements here:

ac QSG UIelements
  1. Project view on the left side presents your project in a familiar way, like Xcode does.

  2. Smart code editor on the right side has tabs for easy navigation between open files.

  3. Navigation bar above the editor additionally allows to quickly run, debug, test or profile your application.

  4. Left gutter: this vertical stripe next to the editor shows the breakpoints you have, and provides a convenient way to navigate through the code hierarchy like going to definition, subclass, superclass, etc. It also shows line numbers and per-line VCS history.

  5. Right gutter: AppCode constantly tracks the quality of your code, and you can see the results of code analysis instantly in the right gutter: errors, warnings, etc. The square in the right corner shows the overall status of code analysis for the file.

  6. Tool windows are specialized windows attached to the bottom and sides of your workspace. These provide access to typical tasks such as project management, source code search and navigation, running and debugging, integration with version control systems, etc.

  7. The status bar indicates the status of your project and the entire IDE. It also shows various warnings and information messages like file encoding, line separator, inspection profile, and so on. In addition, here you can find the Resolve Context chooser for switching between the Debug and Release contexts (with or without debug info) to resolve your code in the IDE with the desired definitions.

Step 3. Customize your environment

Feel free to tweak the IDE so it suits your needs perfectly and is as helpful and comfortable as it can be. Go to AppCode | Preferences to see the list of available customization options.

Appearance

The first thing to fine-tune is the general "look and feel." Go to AppCode | Preferences | Appearance and Behavior | Appearance to select the IDE theme: the default light theme, Darcula if you prefer a darker setting, or Xcode theme.

Editor

The many screens available under AppCode | Preferences | Editor help you adjust every aspect of the editor’s behavior. A lot of options are available here, from general settings (like Drag'n'Drop enabling or scrolling configuration), to color configuration for each available language and use case, to tabs and code folding settings, to code completion behavior and even postfix templates.

Code style

Code style settings can be defined for each language under AppCode | Preferences | Editor | Code Style. These allow you to have your code automatically formatted as you write it, without any additional actions. You can also create and save your own coding style schemes.

ac QSG Preferences

Keymap

AppCode uses the keyboard-centric approach, meaning that nearly all actions possible in the IDE are mapped to keyboard shortcuts. The set of keyboard shortcuts you work with is one of your most intimate habits – your fingers "remember" certain combinations of keys, and changing this habit is easier said than done.

AppCode supplies you with a great default keymap (choose Help | Default Keymap Reference in the main menu) making your coding really productive and convenient. However, you can always change it by going to AppCode | Preferences | Appearance and Behavior | Keymap. There are also some predefined keymaps (like Xcode, Emacs, Visual Studio, Eclipse or NetBeans), and you can also create your own keymap based on an existing one.

Step 4. Code with smart assistance

AppCode takes care of the routine so that you can focus on the important. Use the following coding capabilities to create error-free applications without wasting precious time.

Code completion

Code completion is a great time-saver, regardless of the type of file you’re working with. There are two types of code completion in AppCode: basic (N/A) and smart (N/A). Basic completion works as you type and completes any name instantly. Smart completion analyzes the context you’re currently working in and offers more accurate suggestions based on that analysis. It filters the list of functions and variables to match the expression type:

ac QSG CodeCompletion

Intention actions

AppCode keeps an eye on what you are currently doing and makes smart suggestions, called intention actions, to save more of your time. Indicated with a lightbulb, intention actions let you apply automatic changes to code that is correct (in contrast to code inspections which provide quick-fixes for code that may be incorrect). Do you want to localize the string quickly or use it as a format string? Not a problem with AppCode. Click the lightbulb (or press N/A) and select one of the suggested options:

ac QSG IntentionAction
The full list of available intention actions can be found in AppCode | Preferences | Editor | Intentions.

Step 5. Keep your code neat

AppCode constantly tracks the quality of your code, detects potential errors and problems and suggests quick fixes for them. Every time it finds a potential problem, like unused code, unresolved method, non-localized string or even invalid parameter in a function, you’ll see a light bulb in the left gutter. Click on it, or hit N/A to apply a fix

ac QSG KeepCode

You can also run code analysis in a bulk mode to see all potential problems in your project and fix them at once. To do so, choose Code | Inspect Code from the main menu.

For the complete list of available inspections select Preferences | Editor | Inspections. You can disable some of them, or enable others, plus you can adjust the severity of each inspection. You decide whether it should be considered an error or just a warning.

Step 6. Generate some code

With AppCode you can always practice creating new classes, methods and categories from usage. Just write a definition in your code or type the method name with parameters, press N/A and create method or class definitions automatically:

ac QSG GenerateCode

Adding new classes, protocols, categories, files from Xcode templates, etc. in AppCode is a snap: select File | New... from the main menu, or press N/A. Select an element from the list and enter its name.

AppCode comes with wide set of code generation options. Need a loop, an NSLog call, property declaration? Use Live Templates - the alternative to Xcode snippets. Type the acronym and press N/A.

There are also so-called Surround With templates available with N/A shortcut: select a block of code and hit N/A to surround it with a if, else, @try, @catch, @autoreleasepool, or your own construct that can be defined under Preferences | Editor | Live Templates.

There are various code generation options to be found under Code in the main menu:

  • Override/Implement methods (N/A/N/A) - Override or implement multiple methods with a single shortcut.

  • Declare members - Declare members in an interface or private category, or keep them in the implementation in a second, without the need to navigate anywhere.

  • Generate (N/A) - A powerful code generation tool to automatically create a variety of constructs, for example -initWith methods, -isEqual: or -hash, accessor methods.

Step 7. Find your way through

With a project’s growth and when you work with someone else’s code, it’s vital to be able to quickly find the elements of interest and dig into the code. AppCode comes with a set of navigation features that will help you find your way through any code, no matter how tangled.

Basic search

When you explore a project’s source code, it’s often important to know where this or that symbol is actually used. To find that out, place the caret at the symbol’s name and hit N/A.

ac QSG FindUsages
AppCode will find the actual usages, not just text matches. Moreover, it understands and can be used with localization, Core Data and xib files.

If you need the regular full-text search, just press N/A to search in the current file or N/A to search within arbitrary scope, directory or the entire project.

Project navigation

You can tell a lot just by looking at your File Structure, with its imports or call hierarchies, and possibly use it to navigate to:

The icons in the left-hand gutter can also help you with navigation.

Quick definition and documentation

Quick Definition (N/A) will help you to see the contents of a method without jumping to it. Press N/A (Parameter Info) to see the list of parameters this method can take.

For documentation, just press F1. AppCode also supports two external documentation browsers, Dash and Ingredients, which you can enable by selecting Preferences | Editor | External Documentation.

Navigate through the timeline

Remembering all your activity in the project, AppCode can easily navigate you to the Recent Files (N/A) or Recently Changed Files (N/A). To go through the history of changes, try using Back/Forward navigation (N/AN/A) and/or go to last edit location (N/A).

Find Action

Take advantage of many smart actions possible with AppCode. For example, use the Find Action search (N/A): just type a part of the action name, and the IDE will show you the list of all available options. Then, select the action you need:

ac QSG FindAction

Search Everywhere

If you have a general idea of what you're looking for, you can always locate the corresponding element using one of the existing navigation features. But what if you really want to look for something in every nook and cranny? The answer is to use Search Everywhere! To try it, click the magnifying glass in the upper right-hand corner of the window, or press Shift twice.

Step 8. Refactor

It is important to be able to easily improve code design as it evolves with time. One of the AppCode's most distinguishing features is its refactoring abilities: always at hand, safe and accurate. These are refactorings you can truly rely on, including vital ones as Rename, Move, Extract, Inline, Change Signature, Pull Members Up, Push Members Down, and many others.

Rename safely

When using Rename, you want to be sure all the changes are applied safely. Not to worry - that’s exactly how it is in AppCode. Just place a caret at any element - variable, class, method, property, you name it - and press N/A. Rename even works across non-code usages like xib, storyboard files and localization files.

Extract/Inline

To quickly move code around in a full swing of refactoring, consider inlining some variable, or extracting an expression to a variable. You can even extract a full code block into a new method, and add a parameter to it using Introduce Parameter refactoring.

Refactor This

Refactoring your source code should be easy. That’s why in AppCode you can just press N/A to see what refactorings are suitable for the current context.

Step 9. Run and debug

Now, when you’ve played with the code and discovered what you can do with it, it’s time to run your app. In AppCode this is done by means of so called Run/Debug Configurations. Open Run | Edit Configurations to see all available options.

Run configurations in AppCode reflect Xcode schemes, and synchronize with them. Notice, that Run (N/A and Debug (N/A in AppCode are two different actions. Sometimes launching your app in debug mode could be a heavy operation which can make it more difficult to identify your issue. In this case you may want to run your app without stopping at breakpoints, and try using it the same way your users would.

Debug

AppCode’s debugger offers the perfect runtime view of the application. Once you stop on a breakpoint, it shows descriptions of all the variables available, content of collections and dictionaries, and even actual values of Core Data objects’ properties. Don’t waste your time - investigate the problem instead:

ac QSG Debug

When you need to evaluate the value of an arbitrary expression, we strongly recommend the Evaluate expression feature. Select the expression you need to evaluate, press N/A and see the results in the same way as you see them in the debugger window:

ac QSG EvaluateCode

Step 10. Create and run tests

If you enjoy test-driven development, AppCode is just the right tool to use as it completely supports OCUnit and Kiwi testing frameworks out of the box.

To create a test go to File | New | File from Xcode template and AppCode will generate a standard OCUnit test for you from template. You can also create your own template for a test, or for any other file under Preferences | Editor | File and Code Templates.

In AppCode you can run all tests at once, or a single test. Create different test configurations to suit better your needs: simply specify a test target in a Run Configuration. To run any test configuration, just invoke the Run popup () and select the one you need.

The test runner will display the test results in the dedicated Test view where you can explore them, navigate to the problems, see the test running statistics, and re-run a failing test - no need to re-run them all.

ac QSG testRunner

Step 11. Keep your source code under Version Control

VCS

If you are keeping your source code under version control, you will be glad to know that AppCode integrates with many popular version control systems: Git (or GitHub), Mercurial, Perforce, TFS, Subversion and CVS.

To specify credentials and any settings specific to a particular VCS, go to Preferences | Version Control The VCS menu will give you a clue about what commands are available. For example, you can see the changes you’ve made, commit them, create changelists and much more from the Changes view: VCS | Show Changes View (or just press N/A). Some basic commands can also be easily found in the Navigation bar above the editor:

ac QSG VCS

Local history

In addition to traditional version control, you can use Local History. With Local History, AppCode automatically tracks changes you make to the source code, the results of refactoring, etc. Local History is always enabled. To view it for a file or a folder, select VCS | Local History | Show History. Here you can review the changes, revert them or create a patch.

That’s it! Develop with pleasure!

We hope this brief overview of essential AppCode features will give you a quick start. There are many important features that make a developer’s life easier and more fun, and their source code neater and cleaner. Take these first few steps now, and then dig deeper when you feel the time is right. Enjoy AppCode!

With any questions please visit our AppCode Discussion Forum, twitter and blog, where you can find news, updates, and useful tips and tricks. Also, don't hesitate to report any problems to our support team) or the AppCode issue tracker.

Last modified: 19 September 2019