Last week we started a series of blog posts, in which well-known iOS community members share their AppCode experience. They all answer a very simple question: What are your 5 favorite AppCode shortcuts? First answer from one of the most well-known personalities in the iOS development world, Orta Therox, was already published.
Today we are happy to share with you 5 favourite shortcuts from Paweł Dudek. You probably remember a fantastic webinar (BDDing your Objective-C Apps) done by Paweł and Łukasz Warchoł nearly a year ago. They were talking about leveraging AppCode to empower your BDD workflow.
Paweł on Twitter: @eldudi.
Paweł on GitHub: github.com/paweldudek.
“I’m using the vanilla IntelliJ keymap in AppCode. It was a bit hard to switch over initially, however it’s really beneficial as most of those shortcuts work across all JetBrains products, which makes switching to other IDEs simple.
We’re also doing a lot of pair programming here at Taptera and it’s just simpler when everyone has the same shortcuts – no fighting over which keymap is better 😉
When it comes to shortcuts my first thought when I was asked was “only 5?”, but after giving it few minutes of thought I landed on shortcuts that centre around code refactoring and generation. For me this is the best thing about AppCode – ability to quickly change and generate code. This is also reflected in my statics for shortcuts (actually did you know you can see such thing? Go to Help -> Productivity Guide), Generate Code is quite high on the list.”
Let us now introduce you to Paweł’s 5 favorite shortcuts. We’ll also point out these shortcuts as they come in the Default keymap.
I. Generate Code (
This is definitely one of my favourites. I strongly rely on creating custom initialisers for objects and being able to just click Ctrl+Enter and select
initWith.. is a huge time saver.
Here is also Override/Implement Method (
^I) – two real gems. They allow you to quickly implement or override all the methods your object could have by just pressing
^I. Really cool when you’re using a lot of protocols to abstract things. Moreover you can press
⌥O to show/hide optional methods from the list. Or select (
⌘A) all and just implement them 😉
II. Syntax Aware Selection (
It seems really simple, but it’s been a game changer in how I work with code. It’s actually second on my most used features of AppCode. Being able to quickly select given parameter, or method call, or whole block, or whole method implementation insanely speeds things up.
A common pattern for me when working with code is quickly pressing
⌥Up to select method call and
⌥⌘v to extract variable. That way I don’t have to actually declare variable, I just quickly write the method call and then magic happens.
III. Quick Fix (
I can’t stress enough how important this is when writing code, especially when doing TDD. In TDD tests are always written before implementation. Without AppCode you have to do the mundane task of going to the class you’re testing, declaring method there (and you have to remember all parameters you’re going to use – good luck with blocks), moving to implementation, declaring it there and then finally you can go back to your tests.
With AppCode it’s just ⌥⏎ -> generate method. It understands what objects you’ve passed and automatically prepares method signature. Moreover this works beautifully with blocks! My last favourite feature of Quick Fix is split into declaration and assignment – helps me extract variables when writing BDD-like tests in Specta/Quick.
There’s dozen other ways you can use this and options differ for different contexts. Be sure to check this feature out, you might find a really cool and useful feature!
V. Change Signature (
One that I really love. Being able to just press ⌘+F6 and just add/remove variables in a method signature helps me quickly refactor code. Plus you can move parameters around by pressing ⌥ and Up/Down arrows.
P.S. And a cherry on top (Find Action
There’s one last shortcut that didn’t make into my favourites list and which is extremely useful when you’re starting your adventure with AppCode: Find Action. By pressing ⌘⇧A you get a place where you just type what you want to do and AppCode will tell whether there’s an action like and what’s the shortcut for it (and of course execute it if you select it). This really helped me when I was starting my adventure with this IDE as I remember what it could do, but did not have the muscle memory yet.
That’s it! Many thanks to Paweł for sharing his experience with us!
Develop with pleasure,
The AppCode Team