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
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
Alcatraz 插件管理器 (Deprecated)
安装在终端输入下面命令
成功之后会给你一杯啤酒
Alcatraz successfully installed!!1!🍻 Please restart your Xcode.
然后重启一下Xcode。就可以看到在Menu — Windows 看到
Package Manager
,打开它,然后就长这个样子里面有三种东西:Plugins(插件),Color Themes(颜色主题),Templates(模板)
选择你想要的东西,点击==INSTALL==按钮开始安装,完成之后会显示红色的==REMOVE==按钮。
卸载打开终端粘贴下面的命令:
删除掉Alcatraz安装的所有插件:
常用插件Alcatraz里面常用插件说明
插件
用途
注释辅助插件,主要用于收集并列出项目中的TODO,FIXME,`???
为CocoaPods添加了一个菜单项
添加引用文件有时候非常麻烦,如果你需要引入一个pod头文件,Xcode自带的自动补全自然帮不了你,这时候你可以用Peckham插件解决这个问题。Command+Control+P解决所有的引入
代替Xcode的autocomplete,它利用模式匹配算法来解决问题。
使用它和你的Git库同步,如果你想手动导入一个Snippet需要很麻烦的步骤,通过这个插件你只需要点击几下鼠标。
改变调试控制台颜色,这个插件配合CocoaLumberjack使用效果非常好
输入三个斜线“\/\/\/”,自动生成规范化的注释
可以在当前的窗口内创建一个代码迷你地图,并在屏幕上高亮提示
代码对齐,Shift + Cmd + X
经常输入大段文本的时候,如果文本里面有各种换行和特殊字符,经常会让人很头疼,有了HOStringSense,再也不不用为这个问题犯愁了,顺便附送字数统计功能。
代码里的那些冷冰冰的颜色数值,到底时什么颜色?如果你经常遇到这个问题,每每不得不运行下模拟器去看看,那么这个插件绝对不容错过。更彪悍的是你甚至可以点击显示的颜色面板,直接通过系统的ColorPicker来自动生成对应颜色代码,再也不用做各种颜色代码转换了!
CLang代码格式化
代码、图片、文件搜索利器,快捷键CMD + SHIFT +X
Xcode更新后插件不能用的解决办法运行下面的命令
Last updated