简体   繁体   English

有没有关于构建Xcode 4插件的文档?

[英]Is there any documentation for building Xcode 4 plugins?

Recently I've noticed a couple of projects on github that extend the functionality of Xcode 4 via plugins. 最近我注意到github上的几个项目通过插件扩展了Xcode 4的功能。

Two projects as examples by @olemoritz : 作为@olemoritz的例子,有两个项目:

Both projects are installed into ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins and Xcode just picks them up. 这两个项目都安装在~/Library/Application Support/Developer/Shared/Xcode/Plug-ins而Xcode只是选择它们。

Are there any sources of documentation (officlal or user generated) on extending Xcode? 在扩展Xcode方面是否有任何文档来源(officlal或用户生成)?

Edit: ping @olemortiz ;) 编辑: ping @olemortiz ;)

As I wrote those plugins you mentioned, here are some pointers: 当我写下你提到的那些插件时,这里有一些指示:

  • There is no official documentation from Apple, so while Xcode does have a plugin infrastructure, it is entirely private API. Apple没有官方文档,因此虽然Xcode确实有插件基础设施,但它完全是私有API。 (but hey, no one wants to submit Xcode plugins to the App Store, right? ;)) – The usual warnings apply: You should code very defensively, and it's possible that Xcode updates break things. (但是,嘿,没有人想将Xcode插件提交到App Store,对吧?;)) - 通常的警告适用:你应该非常防御性地编码,并且Xcode更新可能会破坏事物。 Any plugin can bring Xcode down entirely, so be careful. 任何插件都可以完全降低Xcode,所以要小心。

  • There is a seemingly abandoned effort to document the plugin interface here . 这里记录插件界面似乎已经放弃

  • There are some open source projects that allow you to see what's needed to get a plugin loaded at all, eg mine and there's CLITool-Infoplist (I think that's where I got the basic structure from, but I can't really remember, because I've been doing this without publishing anything for quite a while). 有一些开源项目可以让你看到加载插件所需要的东西,例如我的,还有CLITool-Infoplist (我认为这是我得到基本结构的地方,但我真的不记得了,因为我一直这样做而没有发布任何东西很长一段时间)。

  • You can use class-dump to generate headers from Xcode's private frameworks, eg IDEKit and IDEFoundation (in Xcode.app/Contents/Frameworks ). 您可以使用class-dump从Xcode的私有框架生成头文件,例如IDEKit和IDEFoundation(在Xcode.app/Contents/Frameworks )。 Reading those gives you quite a bit of information on how Xcode is structured internally. 阅读这些内容可以为您提供有关Xcode内部结构的大量信息。 DVTKit and DVTFoundation (in Xcode.app/Contents/SharedFrameworks ) can also be useful to class-dump. DVTKit和DVTFoundation(在Xcode.app/Contents/SharedFrameworks )对于类转储也很有用。

  • You can observe all notifications that are sent in Xcode by registering an observer for nil . 您可以通过注册nil的观察者来观察在Xcode中发送的所有通知。 I initially just logged all those notifications to get an idea of where I might be able to hook into. 我最初只记录了所有这些通知,以了解我可以在哪里挂钩。

Good luck! 祝好运!

There is no formal API or documentation. 没有正式的API或文档。

Having said that nearly all community plugins are open sourced, use http://alcatraz.io to discover new plugins, then follow their github source code to learn how people are implementing them. 说过几乎所有的社区插件都是开源的,使用http://alcatraz.io来发现新的插件,然后按照他们的github源代码来了解人们如何实现它们。

Here are some useful resources: 以下是一些有用的资源:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM