Any ReSharper equivalent for Xcode?
Asked Answered
C

5

40

I'm a complete Xcode/Objective-C/Cocoa newbie but I'm learning fast and really starting to enjoy getting to grips with a new language, platform and paradigm.

One thing is though, having been using Visual Studio with R# for so long I've kind of been spoiled with the coding tools such as refactorings and completion etc and as far as I can tell Xcode has some fairly limited built in support for this stuff.

On that note, does anyone know if any add-ins or whatever are available for the Xcode environment which add coding helpers such as automatically generating implementation skeletons from a class interface definition etc?

I suspect there aren't but I suppose it can't help to ask.

Cassiterite answered 21/8, 2008 at 16:18 Comment(2)
AppCode jetbrains.com/objcNiggling
None, nope. Maybe co-pilot for 50%Ballou
L
40

You sound as if you're looking for three major things: code templates, refactoring tools, and auto-completion.

The good news is that Xcode 3 and later come with superb auto-completion and template support. By default, you have to explicitly request completion by hitting the escape key. (This actually works in all NSTextViews; try it!) If you want to have the completions appear automatically, you can go to Preferences -> Code Sense and set the pop-up to appear automatically after a few seconds. You should find good completions for C and Objective-C code, and pretty good completions for C++.

Xcode also has a solid template/skeleton system that you can use. You can see what templates are available by default by going to Edit -> Insert Text Macro. Of course, you don't want to insert text macros with the mouse; that defeats the point. Instead, you have two options:

  1. Back in Preferences,go to Key Bindings, and then, under Menu Key Bindings, assign a specific shortcut to macros you use often. I personally don't bother doing this, but I know plenty of great Mac devs who do
  2. Use the CompletionPrefix. By default, nearly all of the templates have a special prefix that, if you type and then hit the escape key, will result in the template being inserted. You can use Control-/ to move between the completion fields.

    You can see a full list of Xcode's default macros and their associated CompletionPrefixes at Crooked Spin.

    You can also add your own macros, or modify the defaults. To do so, edit the file /Developer/Library/Xcode/Specifications/{C,HTML}.xctxtmacro. The syntax should be self-explanatory, if not terribly friendly.

Unfortunately, if you're addicted to R#, you will be disappointed by your refactoring options. Basic refactoring is provided within Xcode through the context menu or by hitting Shift-Apple-J. From there, you can extract and rename methods, promote and demote them through the class hierarchy, and a few other common operations. Unfortunately, neither Xcode nor any third-party utilities offer anything approaching Resharper, so on that front, you're currently out of luck. Thankfully, Apple has already demonstrated versions of Xcode in the works that have vastly improved refactoring capabilities, so hopefully you won't have to wait too long before the situation starts to improve.

Licht answered 21/8, 2008 at 20:33 Comment(5)
I am new to XCode myself and I am trying to take your advice, but I fear it has been outdated or I am missing something. Under /Developer/Library/Xcode, I have no Specifications directory and if I do a search, I find no file ending in .xctxtmacro. I am running XCode 3.2.5 - any suggestions?Guillory
After using XCode every working day for 2 years, it truely rates a million points behind VisualStudio's resharper and Eclipse in terms of the IDE understanding the code you are writing and refactoring tools.Tapis
Using Xcode nowadays just makes me angry and depressed. After being in more than a years development, it still crashes far too frequently, has glitches galore and UI gaffs aplenty. If it weren't for AppCode I would be constantly upset and angry whilst coding for iOS. I've coded in it for more than 4 years now and it's just as bad now as it was back then. Possibly even worse. Such a shame.Freesia
xCode crashes on me every 2 days and the auto complete is just ok. I do like the blocks it makes, but as far as being able to write code faster xCode prevents you from doing it. xCode is light years behind resharperBallou
Xcode rating behind VS woefully is still true unfortunately in 2022 with Xcode 14. It’s been 18 years I left Resharper and Xcode is nowhere near 5% or what VS could do back then.Teddytedeschi
F
22

I'm excited to say that JetBrains have decided to make a decent IDE for Objective-C coders.

It's called AppCode and it's based on their other tools like RubyMine and Resharper. It's not native Cocoa, but has loads of raw refactoring power.

http://www.jetbrains.com/objc/index.html

I've started using it for my main Objective C project and I'm already in love. It's still in it's infancy, but for code editing and refactoring it already blows Xcode away.

Update

It's now at a totally usable speed. I've switched over to it full time and it still blows my mind how amazing refactoring and coding is compared with Xcode. It just handles so much for you - auto importing, almost infinite customisation. It makes Xcode look like a toy.

Freesia answered 11/4, 2011 at 16:53 Comment(6)
+1 AppCode´s IDE is really welcome on the Mac platform. XCode needs the competitionNiggling
Yeah, I couldn't agree more. I've been frustrated by Xcode for a long, long time. lapsusapp.co.uk/2011/04/15/appcode-the-answer-to-my-ide-woesFreesia
I should add that for now, I've stopped using AppCode - it's still just too slow for anything practical. But I look forward to the time when it can kick Xcode's ass in a speed competition as well as features!Freesia
Incidentally... that time is now. At the time of this comment, AppCode is at V1.0.4 and is fast. In my view, there's no reason to code in Xcode any more. AppCode is so much nicer. As a V1 application, it's mind-blowingly great.Freesia
What about interface builder support though? I absolutely love the work flow in Xcode with IB: designing storyboards, hooking up outlets etc. Is there anything comparable in AppCode?Cobos
Chris - nope. Nothing like this. They make no apologies for that either - they're not trying to totally replace Xcode, despite my slightly misleading comments to the contrary. In my view, IB is fine as it is - it's the coding side of things that had to get better. AppCode is designed so that you can leave Xcode open with the same project alongside and the two work... well, OK together. :)Freesia
A
5

Xcode has refactoring for C and Objective-C built in. Just select what you'd like to refactor, choose "Refactor..." from either the menu bar or the contextual menu, and you'll get a window including the available refactorings and a preview area.

Xcode doesn't currently have a public plug-in API; if there are specific types of plug-ins you'd like Apple to enable, file enhancement requests in the Bug Reporter. That way Apple can count and track such requests.

However, there are third-party tools like Accessorizer and mogenerator (the latest release is mogenerator 1.10) that you can use to make various development tasks faster. Accessorizer helps you create accessor methods for your classes, while mogenerator does more advanced code generation for Core Data managed object classes that are modeled using Xcode's modeling tools.

Admire answered 21/8, 2008 at 20:4 Comment(0)
I
3

Just so people know, Accessorizer does more than just generate accessors (both 1.0 and properties for 2.0) it also generates Core Data code for persisting non-standard attributes, your NSSet accessors for custom to-many relationships.

In fact, Accessorizer will help provide you with the init, keypath, keyed-archiving, indexed accessors, accessors for unordered collections such as NSSet, copyWithZone, KVO, key-validation, singleton overrides, dealloc, setNilForKey, non-standard attribute persistence (Core Data), locking, headerdoc, convert method to selector, NSUndoManager methods and more.

Inexact answered 18/2, 2009 at 20:58 Comment(0)
C
0

I found some xtmacro files in Xcode.app package: /Developer/Applications/Xcode.app/Contents/PlugIns/TextMacros.xctxtmacro/Contents/Resources

Installed Xcode ver. 3.2.5.

Cinda answered 14/12, 2010 at 22:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.