我是一个完全的Xcode/Objective-C/Cocoa新手,但我学得很快,真的开始喜欢掌握一种新的语言、平台和范例.
不过有一件事是,在使用Visual Studio和R#这么长时间以来,我已经被重构和完成等编码工具宠坏了,据我所知,Xcode对这些东西的内置支持相当有限.
关于这一点,有人知道Xcode环境中是否有任何附加模块或任何东西可以添加编码帮助程序,比如从类接口定义自动生成实现框架等?
我想没有,但我想问问也没用.
我是一个完全的Xcode/Objective-C/Cocoa新手,但我学得很快,真的开始喜欢掌握一种新的语言、平台和范例.
不过有一件事是,在使用Visual Studio和R#这么长时间以来,我已经被重构和完成等编码工具宠坏了,据我所知,Xcode对这些东西的内置支持相当有限.
关于这一点,有人知道Xcode环境中是否有任何附加模块或任何东西可以添加编码帮助程序,比如从类接口定义自动生成实现框架等?
我想没有,但我想问问也没用.
听起来你好像在寻找三件主要的东西:代码模板、重构工具和自动完成.
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 NSTextView
s; 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:
使用CompletionPrefix
.默认情况下,几乎所有模板都有一个特殊的前缀,如果您键入并按下escape键,将导致插入模板.可以使用Control-/在完成字段之间移动.
你可以在Crooked Spin看到a full list of Xcode's default macros and their associated CompletionPrefix
es.
也可以添加自己的宏,或修改默认值.为此,请编辑文件/Developer/Library/Xcode/Specifications/{C,HTML}.xctxtmacro
.语法应该是不言自明的,如果不是非常友好的话.
不幸的是,如果你沉迷于R#,你会对重构选项感到失望.在Xcode中,通过上下文菜单或点击Shift-Apple-J提供基本的重构.从那里,您可以提取和重命名方法,通过类层次 struct 升级和降级方法,以及其他一些常见操作.不幸的是,无论是Xcode还是任何第三方实用程序都没有提供任何接近Resharper的功能,因此在这方面,您目前运气不佳.谢天谢地,苹果已经在工作中展示了Xcode版本,这些版本极大地提高了重构能力,所以希望你不必等待太久,情况就会开始改善.