All Projects → guohongwei719 → Ghwxcodeextension

guohongwei719 / Ghwxcodeextension

Xcode Source Editor Extension 插件,实现功能有四个,一.初始化自定义view、UICollectionViewCell、UITableViewCell、viewController,自动删除无用代码和添加默认代码;二. 为属性自动添加懒加载代码、对应协议声明和协议方法,主要有 UITableView\UICollectionView\UIScrollView\UIButton\UILabel\UIImageView; 三.选中一个类,文件顶部自动添加对应的 import; 四. 给 import 分组排序,从上到下为 主类头文件、viewController、view、manager & logic、第三方库、model、category、其他。

Projects that are alternatives of or similar to Ghwxcodeextension

Xcodesourceeditorextension Alignment
This Xcode source editor extension align your assignment statement.
Stars: ✭ 211 (+77.31%)
Mutual labels:  xcode, xcode-extension
Accesscontrolkitty
Xcode extension - quickly change access control level (public, private etc.) of selected Swift code by Editor menu item or keyboard command
Stars: ✭ 119 (+0%)
Mutual labels:  xcode, xcode-extension
Awesome Xcode Extensions
Awesome native Xcode extensions.
Stars: ✭ 2,628 (+2108.4%)
Mutual labels:  xcode, xcode-extension
Comment Spell Checker
Xcode extension for spell checking and auto-correcting code comments.
Stars: ✭ 155 (+30.25%)
Mutual labels:  xcode, xcode-extension
Xgist
Xcode extension to send code to GitHub's Gist
Stars: ✭ 75 (-36.97%)
Mutual labels:  xcode, xcode-extension
Xcodeequatablegenerator
Xcode 8 Source Code Extension will generate conformance to Swift Equatable protocol based on type and fields selection.
Stars: ✭ 188 (+57.98%)
Mutual labels:  xcode, xcode-extension
Playalways
Create Xcode playgrounds from your menu bar
Stars: ✭ 515 (+332.77%)
Mutual labels:  xcode, xcode-extension
Swiftai
SwiftAI, write Swift code smart. SwiftAI can generate Model class from JSON now. Codable and HandyJSON is supported. More features will be add.
Stars: ✭ 470 (+294.96%)
Mutual labels:  xcode, xcode-extension
Linessorter Xcode Extension
Xcode Extension that helps you keep your import statements and long code lists organized and uniform
Stars: ✭ 54 (-54.62%)
Mutual labels:  xcode, xcode-extension
Import
Xcode extension for adding imports from anywhere in the code ☝️
Stars: ✭ 818 (+587.39%)
Mutual labels:  xcode, xcode-extension
Nef Plugin
🔌 an Xcode extension to use nef features easily
Stars: ✭ 144 (+21.01%)
Mutual labels:  xcode, xcode-extension
Swimat
An Xcode formatter plug-in to format your swift code.
Stars: ✭ 1,388 (+1066.39%)
Mutual labels:  xcode, xcode-extension
Xcode developer disk images
Stars: ✭ 125 (+5.04%)
Mutual labels:  xcode, xcode-extension
Linex
Feature packed Xcode extension
Stars: ✭ 210 (+76.47%)
Mutual labels:  xcode, xcode-extension
Swiftmockgeneratorforxcode
An Xcode extension (plugin) to generate Swift test doubles automatically.
Stars: ✭ 522 (+338.66%)
Mutual labels:  xcode, xcode-extension
Snowonder
🔮 Magical import declarations formatter for Xcode
Stars: ✭ 100 (-15.97%)
Mutual labels:  xcode, xcode-extension
Swift Init Generator
An Xcode plugin that uses the Swift parser to generate initializers
Stars: ✭ 105 (-11.76%)
Mutual labels:  xcode, xcode-extension
Device
Light weight tool for detecting the current device and screen size written in swift.
Stars: ✭ 1,503 (+1163.03%)
Mutual labels:  xcode
Speculid
Easily Manage Graphics in Xcode Projects
Stars: ✭ 115 (-3.36%)
Mutual labels:  xcode
Hmap
hmap is a command line tool written in Swift to work with Clang header maps produced by Xcode.
Stars: ✭ 110 (-7.56%)
Mutual labels:  xcode

一个好用的 Xcode 扩展:GHWXcodeExtension

目录

一. 前言
二. 功能演示(注:均可配置快捷键,实现一键操作)
三. 安装配置方法
四. 使用注意事项
五. 调试 GHWXcodeExtension
六. 后记

一. 前言

在 Xcode8 以前,开发者可以在 Xccode 运行时通过注入代码来实现插件的功能。插件可以在Alcatraz 上面提交和分发。不过 Xcode8 禁止了该方式的插件安装,转而向开发者提供了Xcode Source Editor Extension(以下简称 Extension)的方式来做插件。平时写代码过程中发现有很多代码都是重复的,属于无脑代码,而且团队协作中统一的代码格式规范非常重要,因此试图通过 Extension 解决这些问题,从而开发了这个工具。

实现的功能:

  1. 初始化自定义view、UICollectionViewCell、UITableViewCell、viewController,自动删除无用代码和添加默认代码;
  2. 为属性自动添加懒加载代码、对应协议声明和协议方法,主要有 UITableView\UICollectionView\UIScrollView\UIButton\UILabel\UIImageView;
  3. 选中一个类,文件顶部自动添加对应的 import;
  4. 给 import 分组排序去重,从上到下为 主类头文件、viewController、view、manager & logic、第三方库、model、category、其他。

二. 功能演示(注:均可配置快捷键,实现一键操作)

1. 初始化自定义view、UICollectionViewCell、UITableViewCell、viewController,自动删除无用代码和添加默认代码;

(image)

2. 为属性自动添加懒加载代码、对应协议声明和协议方法,主要有 UITableView\UICollectionView\UIScrollView\UIButton\UILabel\UIImageView;

(image)

注意:需要添加懒加载代码的属性需要被光标选中

3. 选中一个类,文件顶部自动添加对应的 import;

(image)

4. 给 import 分组排序去重,从上到下为 主类头文件、viewController、view、manager & logic、第三方库、model、category、其他。

(image)

注意:

  1. 如果不选中对应的 import 则默认是所有 import 行,如果选中的话则只会对选中的 import 分组排序去重
  2. viewController 后缀小写必须为 "controller.h"、"vc.h";
  3. view 后缀小写必须为 "view.h"、"bar.h"、"cell.h";
  4. manager & logic 后缀小写必须为"manager.h"、"logic.h"、"helper.h"、"services.h"、"service.h"。

三. 安装配置方法

1. 将项目 clone 下来,如果不想 clone 项目,直接去 release 下面下载生成的 GHWXcodeExtension.zip,链接 https://github.com/guohongwei719/GHWXcodeExtension/releases,解压即可,然后跳到第三步,如下图

2. 将 clone 的项目编译成功,到 Products 下,选择 GHWXcodeExtension.app 右键,选择 Show in Finder

3. 将 GHWXcodeExtension 复制到应用程序下面,双击打开

4. 到 系统偏好设置 找到 扩展,选择 Xcode Source Editor,选中 GHWExtension

5. 打开项目以后,可以在 Xcode 菜单栏,选择 Editor, 可以看到 GHWExtension 出现在最下面

6. 选择 GHWExtension,出现可以使用的功能选项,顾名思义

7. 四个功能选项都可以配置快捷键,实现一键操作,推荐分别设置为 option+z\option+x\option+c\option+v,如下图

四. 使用注意事项

1. 使用 addLazyCode 功能的时候,如果添加了代码后想撤销,使用 command + z,这时候 Xcode 可能会 crash,这应该是 Xcode 本身的一个 bug,所以需要注意一下,正常情况下添加以后也不会撤销,如果要撤销手动删除也很方便,即使 crash 了再打开就行了,打开以后是删除状态。希望苹果能尽快修复这个 bug。

五. 调试 GHWXcodeExtension

1. 选择 GHWExtension scheme

2. 运行,选择 xcode,点击 run

3. 选择一个项目

六. 后记

欢迎提 bug 和 feature。
微博:黑化肥发灰11
简书地址:https://www.jianshu.com/u/fb5591dbd1bf
掘金地址:https://juejin.im/user/595b50896fb9a06ba82d14d4

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].