directory
Preface two. Functions (note: all can be configured with shortcut keys to achieve one-key operation) three. Installation and Configuration Method 4. Use precautions five. Debug GHWXcodeExtension 6. Afterword.
Project address: github.com/guohongwei7…
A preface.
Prior to Xcode8, developers could implement plug-in functionality by injecting code at Xccode runtime. Plug-ins can be submitted and distributed on Alcatraz. However, Xcode8 forbids this method of plug-in installation, and instead provides developers with Xcode Source Editor Extension. In the process of writing code, I found that many codes are repetitive and mindless, and unified code format standards are very important in team collaboration. Therefore, I tried to solve these problems through Extension, so I developed this tool.
2. Realized functions (Note: all can be configured with shortcut keys to achieve one-key operation)
1. Initialize custom view, UICollectionViewCell, UITableViewCell, viewController, automatically delete useless code and add default code;
UITableView\UICollectionView\UIScrollView;
3. Select a class and import is automatically added to the top of the file.
4. Group import files into main headers, viewController, View, Manager & Logic, third-party libraries, Model, Category, and others from top to bottom.
Iii. Installation and configuration methods
1. Clone the project. If you don’t want to clone the project, go directly to release to download the generated GHwXcodeExtension. zip, linkGithub.com/guohongwei7…, decompress, and then jump to the third step, as shown below
2. Compile clone project successfully, go to Products, right-click ghwXCodeExtend. app, and choose Show in Finder
3. Copy GHWXcodeExtension under the application and double-click to open it
4. Go to system preferences to find the extension, select Xcode Source Editor, and select GHWExtension
5. After opening the project, from the Xcode menu bar, select Editor and see GHWExtension at the bottom
6. Select GHWExtension and the available feature options appear, as the name implies
7. You can configure shortcut keys for the three function options to achieve one-click operation. It is recommended to set them to Option +z\option+x\option+ C, as shown in the following figure
Four. Precautions for use
1. When using addLazyCode, if you want to undo the code after adding it, use Command + z, at this time, Xcode may crash, which should be a bug of Xcode itself, so it should be noted that under normal circumstances, it will not undo after adding the code. If you want to undo manual delete is also very convenient, even if the crash to open again on the line, open after the deletion state. Hope Apple fixes this bug soon.
Debug GHWXcodeExtension
1. Select the GHWExtension scheme
2. Run, select Xcode, and click Run
3. Pick a project
6. Afterword.
Welcome to bugs and features. Weibo: black fertilizer hair grey 11 Jane books address: www.jianshu.com/u/fb5591dbd… Nuggets address: juejin.cn/user/345652…