Xcode奇淫巧技(三)——Xcode 8 插件

弘焕
2023-12-01

Xcode奇淫巧技(三)——Xcode 8 插件

苹果为了避免类似 Xcode Ghost 事件的再次发生,Xcode8 禁用了插件机制,而开放了另一种形式:Source Editor extensions,但是这种形式局限性太大。本文介绍Xcode 8 继续使用插件。

Tips:使用之前请先备份Xcode,安装插件后不可打包上传Appstore,使用请谨慎!

恢复Xcode 8 插件

  • 原Xcode 插件安装目录

    tips:如果遇到插件引起Xcode crash的情况,可在改目录下删除对应插件

 ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins

  • 删除所有原插件
cd ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-in

rm -rf ../Plug-ins

  • 对Xcode进行重签名

    钥匙串访问 -> 证书助理 -> 创建证书
    名称:XcodeSigner
    身份类型:自签名根证书
    证书类型:代码签名

    期间允许所有权限

sudo codesign -f -s XcodeSigner /Applications/Xcode.app

  • 安装Alcatraz
curl -fsSL https://raw.github.com/alcatraz/Alcatraz/master/Scripts/install.sh | sh

  • 修改UUID
find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add 'defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID'

  • 重启Xcode,选择 load bundles

    通过 Alcatraz 安装插件后,重启Xcode不出现 load bundles 提示框,执行“修改UUID”,再重启Xcode。
    某些插件无法通过Alcatraz安装,可直接通过github下载打开。


插件

大部分插件还是能够正常使用,以下列举若干。


A simple plugin for Xcode to adjust font size without going into Settings → Fonts & Colors and changing each source type.
Simply hit ⌘ + or ⌘ - and all fonts will be adjusted. Plugin respects different font sizes per each syntax type.


AllTargets is a plugin for Xcode. The plugin intends to auto select targets depending of the selected configuration when you add files to the project.


A simple Xcode plugin to generate implement code for the selected method, selector and const string, currently, only support objective-c.


Xcode plugin for fixing bug in Xcode 6+: if you input “@”, auto completion does not work, you still need to press “ESC” to show the auto completion list.


This is a convenient and fast approach to create property. You do not need to type @property and nonatomic when you declare a property.


Quickly import your headers on the fly without having to manually go to the top of your file and type the import statement.


Xcode plugin for C Style Comment(uncomment) /**/


An Xcode plug-in to format your import headers in a systematic manner. It simply removes duplicates, spaces and sorts them alphabetically making it much more easier to read and avoid duplicate imports. Works with @imports, #include, #import and import.


A plugin for Xcode that shows colours and allows you to modify them. It works for both UIColor and NSColor in Swift and Objective-C.


With thanks to the genius who suggested this plugin, GitDiff displays deltas against a git repo in the Xcode source editor once you’ve saved the file. To use, copy this repo to your machine, build it and restart Xcode. Differences should then be highlighted in orange for lines that have been modified and blue for new code. A red line indicates code has been removed. Hover over deleted/modified line number to see original source and after a second a button will appear allowing you to revert the change.


This plugin is used to autocompletion enum members for Objective-C


Highlight the String which is same to selected string.


Injection for Xcode is an Xcode plugin (available via Alcatraz) or AppCode that dynamically inserts new Swift / Objective-C code into a running app in order to speed up your build process. It does this without making any changes to your project.


IntelliPaste is an Xcode plugin that makes copy-pasting methods and RGB colors easier.


  • KSHObjcUML

     快捷键:Select Product->Objc-UML or Swift-UML
    

KSHObjcUML can show oriented graph of dependencies between Objective-C and Swift classes in your project. This plugin is based on objc-dependency-visualizer.


Can’t remember whether that image you just added to the project was called button-separator-left or button-left-separator? Now you don’t have to, because this will autocomplete your imageNamed: calls like you’d expect. Just type in [NSImage imageNamed: or [UIImage imageNamed: and all the images in your project will conveniently appear in the autocomplete menu. You’ll even get a handy preview of the image you’re about to select.


SCXcodeSwitchExpander is a small Xcode plugin that expands switch statements by inserting missing cases.


Writing documentation is so important for developing, but it is really painful with Xcode. Think about how much time you are wasting in pressing ‘*’ or ‘/’, and typing the parameters again and again. Now, you can find the method (or any code) you want to document to, and type in ///, the document will be generated for you and all params and return will be extracted into a Javadoc style, which is compatible with appledoc, Doxygen and HeaderDoc. You can just fill the inline placeholder tokens to finish your document.


  • XAlign(无效)

     快捷键:Shift+Cmd+X
    

An amazing Xcode plugin to align regular code. It can align anything by using custom alignment patterns.


摘录:

http://www.cnblogs.com/shidaying/p/6232254.html

 类似资料: