Proficiency in Xcode is the very first requirement for any aspiring iOS app developer. Even experienced developers can miss out on some of the interesting hotkeys and shortcuts that the latest version of the Apple IDE offers. We will here familiarize readers with some of the best features and functionality of Xcode.
Xcode has been the default integrated development environment (IDE) for iOS app development experts for years now. The introductory version of Xcode was launched way back in 2003, and at present, version 6.1 (available for free download at the Mac App Store) is available. Professional app developers need to have a thorough knowledge of working with the latest version of Xcode, to make the best use of this truly user-friendly tool. Here are some features and tricks of Xcode that you will find handy:
- Making more screen space – When you are creating an iPhone app that involves relatively lengthy coding, managing the total screen space can become an issue. Thankfully, Xcode offers an easy solution for this. All that you need to do is hit ‘Command+0’, and you will be able to toggle the navigation panel from being displayed or hidden. The screen no longer needs to get cluttered, no mattered how complex the app codes might be.
- Creating Sort Descriptors – To make sure that the array controller has something to bind to (so that code lines in table view can be sorted), Sort Descriptors are required. In Xcode, mobile app developers get them as ‘NSSortDescriptor’. Once the sort descriptor array is created by manual coding, ‘NSSortDescriptor’ can be used for binding any array controller. Of course, the name of the ordering attribute(s) of your entity also needs to be provided.
- Making Key Bindings – Yet another hugely time-saving feature of the Xcode IDE is the option of mapping Keys to Actions. Every logical keystroke can be mapped to a corresponding action – and with a bit of practice, iOS developers would discover how easy the entire process of doing this is. The steps for the key-action mapping is Preferences → Key Bindings → Actions → Keys → (name of the keystroke) → OK.
- Facilitating code building and running – The ‘Play’ button on the Xcode workspace window (you will find it in the left corner) is one of the best features of the IDE. In addition to building a project, codes can be cleaned and run with ease on the workspace. What’s more – there is a host of keyboard shortcuts to make the task of developers that much easier. Play around with the ‘B’, ‘K’, ‘R’ and ‘G’ tabs for a while, and you will get a hang of it.
- Setting bookmarks – iOS app developers often need to segue one file on another, to find specific code snippets and/or make modifications in the program. The Xcode framework allows users to do that – thanks to the bookmark-setting feature. Developers have to hit Ctrl-D and then enter a unique name for their bookmark, before proceeding with seguing files. It would not be advisable to create too many bookmarks though.
- Finding method names and variables – Written a lengthy app code, and need to find out where and how many times a method name has been mentioned? You need not plough through the entire program for that – the ‘Command-Shift-F’ function would find and display the method names you wish to see. The same goes for variables used in the Xcode environment. In addition, older variable names can be replaced with new ones with the help of this Search/Find Navigator functionality. Developers can avail of case-sensitive search features as well.
- Simultaneously viewing multiple code windows – Experts in the domain of iOS app development find this option really useful. When the ‘Option’ tab in the Xcode workspace is held down and the icon for ‘Split Window’ is clicked, multiple code windows can be viewed at the same time. The default split option of the Xcode Split Editor is horizontal, but you can – for the purpose of comparisons – alter the split option to vertical too.
- Navigating the code – Apple’s ‘Open Quickly…’ feature is the best friend of iOS developers, when it comes to navigating long codes snippets and programs. As soon as you start typing in the search box, the file list is loaded automatically, and the names are displayed (drop-down) as suggestions. Simply use the up and down arrows to select the file you wish to view. Particularly when the ‘Project Navigator’ option is not available, the ‘Open Quickly…’ search option comes in mighty useful.
- Using the Instruments UI – In Xcode 6, the smartest (and the easiest) way to make changes to the user interface is by using the new ‘Instruments’ tool. There are buttons for recording and displaying the settings, while app developers can check out the Extended Detail View as well. The option to view the CPU strategy and the Threads strategy (note the three buttons) helps in optimizing how your new iPhone app is using the core.
- Referring to relevant API documentation – While working in the iOS software development kit (SDK), developers might need to check the corresponding API documentation at any time. Xcode makes this apparently tricky task easier than ever. The concerned code has to be double-clicked, in order to generate a popup window – which contains all the relevant class information. Information regarding platform availability (e.g. iPhone OS 3.0) is also displayed.
- Switching from .m to .h files (and vice versa) – Although iPhone app developers who have already started to develop in the Swift programming language no longer need this feature, it is a great aid for those coding in C++ and Objective-C. Hitting ‘Control+Command+Up arrow’ lets users toggle between .h and .m files. All types of implementation and header files currently existing can be viewed by this cool keyboard shortcut technique. While developing programs with any open source resources too, this option proves handy.
- Using the Assistant Editor – The ‘Simulate Document’ feature has disappeared in Xcode 6, with ‘Assistant Editor’ taking its place. While the former definitely had its merits, the new few feature offers more flexibility to developers while working in the IDE’s Interface Builder. A ‘Preview’ option becomes visible once the navigation tab (in the jump bar) is clicked, which helps users select storyboard and/or xib files to view/edit. There have been reports from some quarters though, that this ‘Preview’ option is not visible in the Assistant Editor.
- Mobile app debugging – Testing iPhone/iPad apps thoroughly is of essence, and the Xcode framework helps with that too. The ‘F6’ and the ‘F7’ keyboard buttons are meant for ‘Step over’ and ‘Step into’ functions respectively, while breakpoints can also be added, removed, enabled and disabled via simple keyboard actions. In addition, the debugger itself can be paused and resumed at any time. It’s not for nothing that Xcode is trusted by developers worldwide for customized mobile app development.
- Commenting out code blocks – If you wish to comment (i.e., hide) a line/snippet of code from your program, you need to type ‘Command-/’ (after selecting the line(s) of code that has to be commented). And what if you wish to ‘uncomment’ the code lines later on? Simple – just select the line and type ‘Command-/’ again.
- Running iOS apps real-time – Apart from the debugging option in Xcode discussed above, the IDE allows real-time bug-testing of iOS apps as well. When you hit ‘Command+R’, you can find out whether your application runs properly, or if there are bugs to be removed. The entire procedure of mobile app testing becomes quicker and easier thanks to this feature, since all probable bugs are detected and removed at an early stage.
Binding core data entities with view-based tables is yet another useful feature of Xcode. App developers can change the indentation of their codes, toggle between the Editor and Detail views, and navigate the history of code files. There are keyboard shortcuts in Xcode for building iOS apps (Command+B) too. The way in which the workspace of the IDE has been designed (Editor, Navigator, Utility and Debug areas) also helps in systematic, error-free coding. Xcode 6.2 Beta has already been seeded to developers, and it would be interesting to see what new features it comes with.
Latest posts by Hussain Fakhruddin (see all)
- The Rise & Rise Of The Popularity Of React Native - April 18, 2019
- The Rise Of Empathetic Technology: All You Need To Know - April 15, 2019
- Getting Acquainted With Flutter: A Beginner’s Guide - April 12, 2019