7.1. Xcode扩展插件

Xcode Editor Extension

New Xcode extensions for the source editor let you customize your coding experience. Use extensions to navigate within your editor’s text, and select, modify, and transform your code. Bind your favorite extensions to a keyboard shortcut to make common reformatting tasks a snap. Xcode includes a new template so you can easily create editor extensions and distribute them on the Mac App Store, or sign your extensions with your Developer ID to share them online. And because extensions run in a separate process, Xcode stays safe and stable.

Xcode 8 开始支持一套官方的扩展 API,第一个支持的扩展类型就是源码编辑器的扩展。另一方面, Xcode 采用了系统完整性保护功能(即 SIP) 。这意味着想要将代码注入到 Xcode 进程已经不可能了,现在Alcatraz也只能在无正式签名的Xcode中生效了。因此在Xcode 8后应该使用Editor Extension,下面推荐一些第三方Xcode扩展。

  • JSON-to-Swift-Converter - an open-source Xcode Source Editor extension for creating Swift code from JSON-formatted text.

  • JSON2Swift - a flexible, fast, customizable tool which allows you to generate swift code based on JSON file.

  • Swiftify Xcode extension - allows you to convert Objective-C code to Swift right from Xcode.

  • EasyCode-Xcode - "legal" Xcode Plugin for inserting code in super duper fast lazy way.

  • CodeGenerator - Xcode editor extension for swift code generation.

  • GithubIssuesExtension - Xcode editor extension that adds an ability to post and edit github issues through comment templates

  • XAlign - An amazing Xcode Source Editor extension to align regular code.

  • Alignment -This Xcode source editor extension align your assignment statement.

  • CleanClosureXcode - An Xcode Source Editor extension to clean the closure syntax.

  • xTextHandler - Xcode Source Editor Extension based tools to improve the text editing experience of Xcode 8 and provide extensions with simple code.

  • Xcode-Search - A Xcode Source Editor Extension that searches external sources

  • SwiftLintForXcode - SwiftLint for Xcode is a Xcode Extension that was created to run SwiftLint.

  • XcodeCComment - Xcode Source Editor Extension for C Style Comment /**/

  • Duplicate Line - Xcode's source editor extension to duplicate selected line or lines.

  • Dotify - Convert [[AnObject method1] method2] to AnObject.method1.method2 with Xcode Extension

  • XcodeEditorPlus - Bring some convenient editor shortcuts to Xcode using Xcode Source Editor Extension, inspired from AppCode.

  • XcodeWay - Navigate to many places from Xcode

  • XcodeColorSense2 - An Xcode source editor extension that makes working with color easier

  • strimmer - Strimmer is an Xcode 8 Source Code Extension that quickly strips all trailing whitespace from the current file.

  • Jumpy - Jumpy is an Xcode source editor extension for jumping across multiple lines of code.

  • SETools - Xcode 8 Extension - Figlet Font Titles

  • GenerateSwiftInit - Proof of concept for Xcode 8 source extensions; generate a Swift init from current selection

  • XTExtension - Comment lines.

  • VS-Key-Bindings-For-Xcode - Visual Studio Comment Selection and Uncomment Selection for Xcode 8 extension.

  • Localizer - It then breaks apart any String declarations it founds by splitting the selection based off " and then wrap the resulting String inside NSLocalizedString.

  • EmojifySourceEditorExtension - A Proof-Of-Concept implementation of the new Xcode Source Editor Extension

  • EmojifyApplication - Same as above.

  • xcsort - Sort text or code lines from a text selection. An Xcode extension by @battlmonstr.

  • SwiftLintXcodePlugin - Xcode source extension to help with some SwiftLint rules

  • BDDShortcuts - BDD Shortcuts is an Xcode 8+ plugin that adds handy shortcuts for Swift and BDD frameworks such as Cedar, Quick, Kiwi or Specta.

  • Jump - XCode source editor extension for quick navigating

  • XcodeTopComment - Xcode Source Editor Extension to remove or modify the top comment of a file

  • PAXcodePlugin - Example of Xcode Source Editor Extension

  • XcodeExtension-TotsuzenNoShi - A small "sudden" example of Xcode source code extension

  • ClangFormatter - Xcode Source Editor Extension for clang-format

  • CwlWhitespace - The first command uses multiple selections to select every text range in your file that it believes is violating a whitespace rule. If a line contains a zero-length problem (missing whitespace or missing indent) then the whole line will be selected.

  • DemoXcodeExtension - Select the current scope / block.

  • TestXcodeSourceExtensions - Replace entire files with literals

  • Swimat - An Xcode formatter plug-in to format your swift code

  • FastCommentLine - Moves cursor to next line after commenting/uncommenting current line (like AppCode).

  • SwiftInitializerGenerator - This Xcode 8 Source Code Extension will generate a Swift initializer based on the lines you've selected.

  • Import☝️ - Add imports from anywhere in the code.

  • XcodeEquatableGenerator - Xcode 8 Source Code Extension will generate conformance to Swift Equatable protocol based on type and fields selection.

  • Mark - Generates MARK comments from protocol conformance in class declaration.

  • Propertizer - Autocompletes @property statements with desired type.

  • Eric’s Mark - Identifies IBOutlets, IBActions, Super Classes, Properties (and more) and MARK them.

  • Quick Add - A Xcode Source Editor Extension to quickly add a method implementation with comment from selected text

  • CleanHeaders-Xcode - A Xcode Source Editor Extension to sort your header imports and remove duplicates, similar to iSort.

  • FBXCodeExtension - An Xcode Source Editor Extension providing convenient line manipulation such like line deletion and duplication.

  • Basics - Generates NSCopying, isEquals, hash, and more.

  • HandyXcode - A few 'Handy' Xcode commands (insert code placeholder, multi-line comment, etc.)

  • LocalizedString - Xcode Source Editor Extension that helps to localize Swift and Objective-C source files

  • Xgist - Xcode Source Editor Extension that sends code to GitHub's Gist

  • PlayAlways - Create Xcode playgrounds from your menu bar.

  • CodeCows - Add hundreds of ASCII cows to your source code

  • DeclareType - Generate the type declaration in your file based on the file name

  • Switch Enum Case Generator - Instant switch with selected enum cases

  • XShared - Xcode extension which allows you copying the code with special formatting quotes for social (Slack, Telegram)

  • TabifyIndents - This application adds two feature that Tabify and Untabify to Xcode Source Editor.

  • Literals - Converts UIColor, NSColor, UIImage to literals

  • Pragmatic - An Xcode 8._x _Source Editor extension for simplifying common pragma driven tasks

  • Xcode-NSCoding - Automatically creates NSCoding-implementations from properties

  • LineEscapeEx - Duplicate lines as comment

  • LanguageTranslator - A Xcode Source Editor extension to translate selected text into other language.

  • NamingTranslator - A Xcode Source Editor extension to translate selected variable or method between PascalCase, camelCase and snake_case.

  • CodeGenerator - A Xcode Source Editor extension to generate lazy getter methods from property.

  • MGTextPlus - A Xcode Source Editor extension to duplicate line, delete line, join lines and more.

  • Rubicon - Swift parser + Spy generator.

  • BExtension - Xcode Source extension for delivering enums and variables from enum cases, see this article

其它Extension

Alcatraz 插件管理器 (Deprecated)

安装

在终端输入下面命令

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

成功之后会给你一杯啤酒

Alcatraz successfully installed!!1!🍻 Please restart your Xcode.

然后重启一下Xcode。就可以看到在Menu — Windows 看到Package Manager,打开它,然后就长这个样子

里面有三种东西:Plugins(插件),Color Themes(颜色主题),Templates(模板)

选择你想要的东西,点击==INSTALL==按钮开始安装,完成之后会显示红色的==REMOVE==按钮。

卸载

打开终端粘贴下面的命令:

rm -rf ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin

删除掉Alcatraz安装的所有插件:

rm -rf ~/Library/Application\ Support/Alcatraz/

常用插件

Alcatraz里面常用插件说明

Xcode更新后插件不能用的解决办法

运行下面的命令

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.plist DVTPlugInCompatibilityUUID`

Last updated