/Xcode-AutoLazyLoad

简单的Xcode代码模板extension

Primary LanguageObjective-C

Xcode-AutoLazyLoad

目前支持的功能:

5f9c4cacd10ae74293566d4a908b5441

AutoLazyLoad

.h声明的属性自动生成懒加载方法模板:选中指定需要懒加载的那一行,在系统上面的toolbar中选中选择edit-AutoLazyLoad,执行指定的插件指令,或者在xcode的偏好设置中添加你喜欢的快捷键,选中需要懒加载的属性那一行快捷键生成属性的懒加载代码。

Enum2switch

将NS_ENUM自动转为switch到剪切板,具体使用参照gif,全选需要生成switch的枚举,按下你的扩展快捷键,将会生成指定的switch到剪切板,其余部分与propertylazyload使用一致。

JSON2Property

通过json文本生成属性声明模板

Xcode 8以后的插件是以扩展的形式使用的,类似于sifari插件的形式。 ,在mac中以.app的形式安装,在系统偏好设置-扩展中-选中已经安装的

安装

  1. 使用你自己的证书签名AutoLazyLoad
  2. build工程
  3. 拷贝products目录中的AutoLazyLoad.app到你的应用程序中。
  4. 打开AutoLazyLoad.app,再关掉。只有首次安装需要这个操作。
  5. 打开系统的偏好设置-扩展,勾选上lazyload
  6. 重启xcode就可以使用啦。
  7. 如果有需要可以去xcode的偏好设置中设置快捷键,我是用option+'作为属性懒加载的快捷键
  8. 选中你要生成懒加载的属性,按下option+' 或者通过xcode顶部工具栏选择Editor-Lazyload-propertylazyload就好啦。

移除

如果不想使用了,在系统的应用程序中删除lazyLoad.app,就可以了.

features:

  1. AutoLazyLoad
  2. Enum2switch
  3. JSON2Property

usage:

  1. Setup Code Signing for Target AutoLazyLoad by applying your own Team
  2. Build Target AutoLazyLoad
  3. Copy AutoLazyLoad.app from Products to your Applications folder
  4. Open AutoLazyLoad.app then close it
  5. Open Preference - Extension of macOS, make sure lazyLoad is selected as Xcode Source Editor
  6. Restart Xcode and enjoy it.
  7. add shortcuts if you like, I'm using option+'as the property lazyload shortcuts.
  8. Select the property you want to generate lazy-load code and press option+' or choose Editor-Lazyload-propertylazyloadfrom the Xcode toolbar ,done.

remove:

If you don't need it anymore, Just remove AutoLazyLoad.app from the ../Applications/ folder.