├── gif ├── lazyload.gif ├── quickEnum.gif ├── quickEnum2.gif ├── json2property.gif └── 5f9c4cacd10ae74293566d4a908b5441.png ├── AutoLazyLoad ├── Assets.xcassets │ ├── Contents.json │ ├── lazy_icon.imageset │ │ ├── lazy_icon@2x.png │ │ └── Contents.json │ ├── lazy_icon1.imageset │ │ ├── lazy_icon1@2x.png │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── ViewController.h ├── AppDelegate.h ├── main.m ├── AppDelegate.m ├── ViewController.m ├── Info.plist └── Base.lproj │ └── Main.storyboard ├── .gitignore ├── AutoLazyLoad.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcuserdata │ │ ├── mac.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ ├── zego.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ └── Jason.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── xcuserdata │ ├── zego.xcuserdatad │ │ ├── xcschemes │ │ │ └── xcschememanagement.plist │ │ └── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ ├── Jason.xcuserdatad │ │ ├── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ ├── AutoLazyLoad.xcscheme │ │ │ └── LazyLoad.xcscheme │ │ └── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ └── mac.xcuserdatad │ │ ├── xcschemes │ │ └── xcschememanagement.plist │ │ └── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist ├── xcshareddata │ └── xcschemes │ │ ├── AutoLazyLoad.xcscheme │ │ └── LazyLoad.xcscheme └── project.pbxproj ├── LazyLoad ├── SourceEditorCommand.h ├── SourceEditorExtension.h ├── LazyLoad.entitlements ├── EnumLazyIfelse.h ├── EnumLazySwitch.h ├── Toast.h ├── PropertyLazyLoad.h ├── JsonLazyProperty.h ├── DzwJsonFormatManager.h ├── SourceEditorExtension.m ├── SourceEditorCommand.m ├── DzwClassInfo.h ├── Toast.m ├── Info.plist ├── DzwClassInfo.m ├── JsonLazyProperty.m ├── DzwJsonFormatManager.m ├── EnumLazyIfelse.m ├── PropertyLazyLoad.m └── EnumLazySwitch.m ├── AutoLazyLoad copy-Info.plist └── README.md /gif/lazyload.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dtheme/Xcode-AutoLazyLoad/HEAD/gif/lazyload.gif -------------------------------------------------------------------------------- /gif/quickEnum.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dtheme/Xcode-AutoLazyLoad/HEAD/gif/quickEnum.gif -------------------------------------------------------------------------------- /gif/quickEnum2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dtheme/Xcode-AutoLazyLoad/HEAD/gif/quickEnum2.gif -------------------------------------------------------------------------------- /gif/json2property.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dtheme/Xcode-AutoLazyLoad/HEAD/gif/json2property.gif -------------------------------------------------------------------------------- /AutoLazyLoad/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | AutoLazyLoad.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate 3 | *.xcuserstate 4 | -------------------------------------------------------------------------------- /gif/5f9c4cacd10ae74293566d4a908b5441.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dtheme/Xcode-AutoLazyLoad/HEAD/gif/5f9c4cacd10ae74293566d4a908b5441.png -------------------------------------------------------------------------------- /AutoLazyLoad/Assets.xcassets/lazy_icon.imageset/lazy_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dtheme/Xcode-AutoLazyLoad/HEAD/AutoLazyLoad/Assets.xcassets/lazy_icon.imageset/lazy_icon@2x.png -------------------------------------------------------------------------------- /AutoLazyLoad/Assets.xcassets/lazy_icon1.imageset/lazy_icon1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dtheme/Xcode-AutoLazyLoad/HEAD/AutoLazyLoad/Assets.xcassets/lazy_icon1.imageset/lazy_icon1@2x.png -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dtheme/Xcode-AutoLazyLoad/HEAD/AutoLazyLoad.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/project.xcworkspace/xcuserdata/zego.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dtheme/Xcode-AutoLazyLoad/HEAD/AutoLazyLoad.xcodeproj/project.xcworkspace/xcuserdata/zego.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/project.xcworkspace/xcuserdata/Jason.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dtheme/Xcode-AutoLazyLoad/HEAD/AutoLazyLoad.xcodeproj/project.xcworkspace/xcuserdata/Jason.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AutoLazyLoad/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // AutoLazyLoad 4 | // 5 | // Created by dzw on 2017/9/8. 6 | // Copyright © 2017年 段志巍. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : NSViewController 12 | @end 13 | 14 | -------------------------------------------------------------------------------- /AutoLazyLoad/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AutoLazyLoad 4 | // 5 | // Created by dzw on 2017/9/8. 6 | // Copyright © 2017年 段志巍. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /AutoLazyLoad/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AutoLazyLoad 4 | // 5 | // Created by dzw on 2017/9/8. 6 | // Copyright © 2017年 段志巍. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | -------------------------------------------------------------------------------- /LazyLoad/SourceEditorCommand.h: -------------------------------------------------------------------------------- 1 | // 2 | // SourceEditorCommand.h 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2017/9/8. 6 | // Copyright © 2017年 段志巍. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SourceEditorCommand : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LazyLoad/SourceEditorExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // SourceEditorExtension.h 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2017/9/8. 6 | // Copyright © 2017年 段志巍. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SourceEditorExtension : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LazyLoad/LazyLoad.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.server 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /AutoLazyLoad/Assets.xcassets/lazy_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "lazy_icon@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /AutoLazyLoad/Assets.xcassets/lazy_icon1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "lazy_icon1@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LazyLoad/EnumLazyIfelse.h: -------------------------------------------------------------------------------- 1 | // 2 | // EnumLazyIfelse.h 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2024/7/12. 6 | // Copyright © 2024 dzw. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | extern NSString * _Nonnull const kEnumLazyIfelse; 13 | @interface EnumLazyIfelse : NSObject 14 | + (void)enum2ifelse:(XCSourceEditorCommandInvocation *)invocation; 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /LazyLoad/EnumLazySwitch.h: -------------------------------------------------------------------------------- 1 | // 2 | // EnumLazySwitch.h 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2019/12/24. 6 | // Copyright © 2019 dzw. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString * _Nonnull const kEnumLazySwitch; 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface EnumLazySwitch : NSObject 16 | 17 | + (void)enum2Switch:(XCSourceEditorCommandInvocation *)invocation; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /LazyLoad/Toast.h: -------------------------------------------------------------------------------- 1 | // 2 | // Toast.h 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2024/7/12. 6 | // Copyright © 2024 dzw. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define Toast(format, ...) [Toast showWithMessage:[NSString stringWithFormat:format, ## __VA_ARGS__]] 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface Toast : NSObject 16 | 17 | + (void)showWithMessage:(NSString *)message; 18 | 19 | @end 20 | 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /LazyLoad/PropertyLazyLoad.h: -------------------------------------------------------------------------------- 1 | // 2 | // LazyLoad.h 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2019/12/24. 6 | // Copyright © 2019 dzw. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString * _Nonnull const kPropertyLazyLoad; 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface PropertyLazyLoad : NSObject 16 | 17 | + (void)lazyLoadWithInvocation:(XCSourceEditorCommandInvocation *)invocation; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /LazyLoad/JsonLazyProperty.h: -------------------------------------------------------------------------------- 1 | // 2 | // JsonLazyProperty.h 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2022/1/11. 6 | // Copyright © 2022 dzw. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString * _Nonnull const kJsonLazyProperty; 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface JsonLazyProperty : NSObject 16 | + (void)JSON2Property:(XCSourceEditorCommandInvocation *)invocation completionHandler:(void (^)(NSError * _Nullable nilOrError))completionHandler; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /AutoLazyLoad/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AutoLazyLoad 4 | // 5 | // Created by dzw on 2017/9/8. 6 | // Copyright © 2017年 段志巍. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 18 | 19 | } 20 | 21 | 22 | - (void)applicationWillTerminate:(NSNotification *)aNotification { 23 | // Insert code here to tear down your application 24 | } 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /AutoLazyLoad/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // AutoLazyLoad 4 | // 5 | // Created by dzw on 2017/9/8. 6 | // Copyright © 2017年 段志巍. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | self.title = @"懒人"; 20 | } 21 | 22 | 23 | - (void)setRepresentedObject:(id)representedObject { 24 | [super setRepresentedObject:representedObject]; 25 | 26 | } 27 | 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /LazyLoad/DzwJsonFormatManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // DzwJsonFormatManager.h 3 | // LazyLoad 4 | // 5 | // Created by dzw on 20/11/28. 6 | // Copyright (c) 2020年 dzw. All rights reserved. 7 | // 8 | 9 | #import 10 | @class DzwClassInfo; 11 | @interface DzwJsonFormatManager : NSObject 12 | 13 | /** 14 | * 解析一个类里面属性字段的内容 15 | * 16 | * @param classInfo 类信息 17 | * 18 | * atreturn 19 | */ 20 | + (NSString *)parsePropertyContentWithClassInfo:(DzwClassInfo *)classInfo; 21 | 22 | /** 23 | * 解析一个类头文件的内容(会根据是否创建文件返回的内容有所不同) 24 | * 25 | * @param classInfo 类信息 26 | * 27 | * @return 类头文件里面的内容 28 | */ 29 | + (NSString *)parseClassHeaderContentWithClassInfo:(DzwClassInfo *)classInfo; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/xcuserdata/zego.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AutoLazyLoad copy.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 2 11 | 12 | AutoLazyLoad.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | LazyLoad.xcscheme_^#shared#^_ 18 | 19 | orderHint 20 | 1 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /LazyLoad/SourceEditorExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // SourceEditorExtension.m 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2017/9/8. 6 | // Copyright © 2017年 段志巍. All rights reserved. 7 | // 8 | 9 | #import "SourceEditorExtension.h" 10 | 11 | @implementation SourceEditorExtension 12 | 13 | /* 14 | - (void)extensionDidFinishLaunching 15 | { 16 | // If your extension needs to do any work at launch, implement this optional method. 17 | } 18 | */ 19 | 20 | /* 21 | - (NSArray *> *)commandDefinitions 22 | { 23 | // If your extension needs to return a collection of command definitions that differs from those in its Info.plist, implement this optional property getter. 24 | return @[]; 25 | } 26 | */ 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/xcuserdata/Jason.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AutoLazyLoad.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | LazyLoad.xcscheme 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 96F33C671F62B14A00973AB1 21 | 22 | primary 23 | 24 | 25 | 96F33C821F62B15400973AB1 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/xcuserdata/mac.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AutoLazyLoad.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | LazyLoad.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 96F33C671F62B14A00973AB1 21 | 22 | primary 23 | 24 | 25 | 96F33C821F62B15400973AB1 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/xcuserdata/Jason.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/xcuserdata/mac.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/xcuserdata/zego.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /AutoLazyLoad copy-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2017年 dzw. All rights reserved. 27 | NSMainStoryboardFile 28 | Main 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /AutoLazyLoad/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /AutoLazyLoad/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSApplicationCategoryType 24 | public.app-category.developer-tools 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2024年 dzw. All rights reserved. 29 | NSMainStoryboardFile 30 | Main 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /LazyLoad/SourceEditorCommand.m: -------------------------------------------------------------------------------- 1 | // 2 | // SourceEditorCommand.m 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2017/9/8. 6 | // Copyright © 2017年 段志巍. All rights reserved. 7 | // 8 | 9 | #import "SourceEditorCommand.h" 10 | #import "EnumLazySwitch.h" 11 | #import "PropertyLazyLoad.h" 12 | #import "JsonLazyProperty.h" 13 | #import 14 | #import "DzwClassInfo.h" 15 | #import "JsonLazyProperty.h" 16 | #import "EnumLazyIfelse.h" 17 | #import "Toast.h" 18 | @interface SourceEditorCommand () 19 | @property (nonatomic) BOOL isSwift; 20 | @property (nonatomic, strong) XCSourceTextBuffer *buffer; 21 | @property (nonatomic, copy) void(^completionHandler)(NSError * _Nullable nilOrError); 22 | @end 23 | 24 | @implementation SourceEditorCommand 25 | 26 | - (void)performCommandWithInvocation:(XCSourceEditorCommandInvocation *)invocation completionHandler:(void (^)(NSError * _Nullable nilOrError))completionHandler 27 | { 28 | NSString *identifier = invocation.commandIdentifier; 29 | Toast(@"---- : 【%@】",identifier); 30 | if ([identifier containsString:kPropertyLazyLoad]) { 31 | [PropertyLazyLoad lazyLoadWithInvocation:invocation]; 32 | }else if ([identifier containsString:kEnumLazySwitch]) { 33 | [EnumLazySwitch enum2Switch:invocation]; 34 | }else if ([identifier containsString:kJsonLazyProperty]){ 35 | [JsonLazyProperty JSON2Property:invocation completionHandler:completionHandler]; 36 | }else if ([identifier containsString:kEnumLazyIfelse]){ 37 | [EnumLazyIfelse enum2ifelse:invocation]; 38 | } 39 | completionHandler(nil); 40 | } 41 | 42 | 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /LazyLoad/DzwClassInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // DzwClassInfo.h 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2022/1/11. 6 | // Copyright © 2022 dzw. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DzwClassInfo : NSObject 12 | 13 | @property (nonatomic) BOOL isSwift; 14 | 15 | /** 16 | * 实体类的类名 17 | */ 18 | @property (nonatomic, copy) NSString *className; 19 | /** 20 | * 当前类在JSON里面对应的key 21 | */ 22 | @property (nonatomic, copy) NSString *classNameKey; 23 | /** 24 | * 当前类对应的字典 25 | */ 26 | @property (nonatomic, strong) NSDictionary *classDic; 27 | 28 | /** 29 | * 当前类里面属性对应为类的字典 [key->JSON字段的key : value->DzwClassInfo对象] 30 | */ 31 | @property (nonatomic, strong) NSMutableDictionary *propertyClassDic; 32 | 33 | /** 34 | * 当前类里属性对应为集合(指定集合里面存某个模型,用作MJExtension) [key->JSON字段的key : value->DzwClassInfo对象] 35 | */ 36 | @property (nonatomic, strong) NSMutableDictionary *propertyArrayDic; 37 | 38 | /** 39 | * atclass 内容,用于在创建类文件的时候,指定当前类里面引用哪些类-->通过遍历propertyClassDic生成 40 | */ 41 | @property (nonatomic, copy) NSString *atClassContent; 42 | 43 | /** 44 | * 当前类的需要引用的calss集合 45 | */ 46 | @property (nonatomic, copy) NSArray *atClassArray; 47 | 48 | 49 | /** 50 | * 所有属性对应的格式化的内容 51 | */ 52 | @property (nonatomic, copy) NSString *propertyContent; 53 | 54 | /** 55 | * 整个类头文件的内容,包含头与尾 -- 会根据是否创建文件添加模板文字 56 | */ 57 | @property (nonatomic, copy) NSString *classContentForH; 58 | 59 | /** 60 | * 直接插入到.h文件或者与.swift文件中内容 -- 不包含当前类里面属性字段,只有里面引用类的.h文件内容 61 | */ 62 | @property (nonatomic, copy) NSString *classInsertTextViewContentForH; 63 | 64 | 65 | - (instancetype)initWithClassNameKey:(NSString *)classNameKey ClassName:(NSString *)className classDic:(NSDictionary *)classDic; 66 | 67 | @end 68 | 69 | -------------------------------------------------------------------------------- /LazyLoad/Toast.m: -------------------------------------------------------------------------------- 1 | // 2 | // Toast.m 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2024/7/12. 6 | // Copyright © 2024 dzw. All rights reserved. 7 | // 8 | #import "Toast.h" 9 | 10 | @implementation Toast 11 | 12 | + (void)showWithMessage:(NSString *)message { 13 | NSWindow *mainWindow = [NSApplication sharedApplication].mainWindow; 14 | if (!mainWindow) { 15 | return; 16 | } 17 | 18 | NSRect frame = NSMakeRect(mainWindow.frame.size.width / 2 - 150, mainWindow.frame.size.height - 100, 300, 50); 19 | NSWindow *toastWindow = [[NSWindow alloc] initWithContentRect:frame 20 | styleMask:NSWindowStyleMaskBorderless 21 | backing:NSBackingStoreBuffered 22 | defer:NO]; 23 | toastWindow.backgroundColor = [[NSColor blackColor] colorWithAlphaComponent:0.7]; 24 | toastWindow.opaque = NO; 25 | toastWindow.hasShadow = YES; 26 | toastWindow.level = NSFloatingWindowLevel; 27 | 28 | NSTextField *label = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 300, 50)]; 29 | [label setStringValue:message]; 30 | [label setTextColor:[NSColor whiteColor]]; 31 | [label setBackgroundColor:[NSColor clearColor]]; 32 | [label setBezeled:NO]; 33 | [label setEditable:NO]; 34 | [label setAlignment:NSTextAlignmentCenter]; 35 | 36 | [toastWindow.contentView addSubview:label]; 37 | [mainWindow addChildWindow:toastWindow ordered:NSWindowAbove]; 38 | 39 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 40 | [toastWindow orderOut:nil]; 41 | [mainWindow removeChildWindow:toastWindow]; 42 | }); 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Xcode-AutoLazyLoad 2 | 3 | #### 目前支持的功能: 4 | 5 | ![5f9c4cacd10ae74293566d4a908b5441](https://github.com/Dtheme/Xcode-AutoLazyLoad/blob/master/gif/5f9c4cacd10ae74293566d4a908b5441.png) 6 | 7 | ##### AutoLazyLoad 8 | 9 | .h声明的属性自动生成懒加载方法模板:选中指定需要懒加载的那一行,在系统上面的toolbar中选中选择edit-AutoLazyLoad,执行指定的插件指令,或者在xcode的偏好设置中添加你喜欢的快捷键,选中需要懒加载的属性那一行快捷键生成属性的懒加载代码。 10 | 11 | ![](https://github.com/Dtheme/Xcode-AutoLazyLoad/blob/master/gif/lazyload.gif) 12 | 13 | ##### Enum2switch 14 | 15 | 1. 将NS_ENUM自动转为switch到剪切板,具体使用参照gif,全选需要生成switch的枚举,按下你的扩展快捷键,将会生成指定的switch到剪切板,其余部分与`propertylazyload`使用一致。 16 | 17 | ![](https://github.com/Dtheme/Xcode-AutoLazyLoad/blob/master/gif/quickEnum.gif) 18 | 19 | 2. 将NS_ENUM自动转为if_else到剪切板,具体使用参照gif,全选需要生成if_else的枚举,按下你的扩展快捷键,将会生成指定的if_else到剪切板,其他部分与`propertylazyload`使用一致。 20 | 21 | ![](https://github.com/Dtheme/Xcode-AutoLazyLoad/blob/master/gif/quickEnum2.gif) 22 | 23 | ##### JSON2Property 24 | 25 | 通过json文本生成属性声明模板 26 | 27 | ![](https://github.com/Dtheme/Xcode-AutoLazyLoad/blob/master/gif/json2property.gif) 28 | 29 | 30 | 31 | Xcode 8以后的插件是以扩展的形式使用的,类似于sifari插件的形式。 32 | ,在mac中以.app的形式安装,在系统偏好设置-扩展中-选中已经安装的 33 | 34 | 35 | #### 安装 36 | 37 | 1. 使用你自己的证书签名AutoLazyLoad 38 | 2. build工程 39 | 3. 拷贝`products`目录中的`AutoLazyLoad.app`到你的应用程序中。 40 | 4. 打开`AutoLazyLoad.app`,再关掉。只有首次安装需要这个操作。 41 | 5. 打开系统的`偏好设置-扩展`,勾选上`lazyload`。 42 | 6. 重启xcode就可以使用啦。 43 | 7. 如果有需要可以去xcode的偏好设置中设置快捷键,我是用`option+'`作为属性懒加载的快捷键 44 | 8. 选中你要生成懒加载的属性,按下`option+'` 或者通过xcode顶部工具栏选择`Editor-Lazyload-propertylazyload`就好啦。 45 | 46 | #### 移除 47 | 48 | 如果不想使用了,在系统的应用程序中删除`lazyLoad.app`,就可以了. 49 | 50 | #### features: 51 | 52 | 1. AutoLazyLoad 53 | 2. Enum2switch 54 | 2. JSON2Property 55 | 56 | 57 | #### usage: 58 | 59 | 1. Setup Code Signing for Target `AutoLazyLoad` by applying your own Team 60 | 2. Build Target `AutoLazyLoad` 61 | 3. Copy `AutoLazyLoad.app` from `Products` to your `Applications` folder 62 | 4. Open `AutoLazyLoad.app` then close it 63 | 5. Open `Preference - Extension` of macOS, make sure `lazyLoad` is selected as Xcode Source Editor 64 | 6. Restart Xcode and enjoy it. 65 | 7. add shortcuts if you like, I'm using `option+'`as the property lazyload shortcuts. 66 | 8. Select the property you want to generate lazy-load code and press `option+'` or choose `Editor-Lazyload-propertylazyload`from the Xcode toolbar ,done. 67 | 68 | #### remove: 69 | 70 | If you don't need it anymore, Just remove `AutoLazyLoad.app` from the `../Applications/` folder. 71 | 72 | 73 | -------------------------------------------------------------------------------- /LazyLoad/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | LazyCode 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSExtension 26 | 27 | NSExtensionAttributes 28 | 29 | XCSourceEditorCommandDefinitions 30 | 31 | 32 | XCSourceEditorCommandClassName 33 | SourceEditorCommand 34 | XCSourceEditorCommandIdentifier 35 | $(PRODUCT_BUNDLE_IDENTIFIER).JsonLazyProperty 36 | XCSourceEditorCommandName 37 | JsonLazyProperty 38 | 39 | 40 | XCSourceEditorCommandClassName 41 | SourceEditorCommand 42 | XCSourceEditorCommandIdentifier 43 | $(PRODUCT_BUNDLE_IDENTIFIER).EnumLazySwitch 44 | XCSourceEditorCommandName 45 | EnumLazySwitch 46 | 47 | 48 | XCSourceEditorCommandClassName 49 | SourceEditorCommand 50 | XCSourceEditorCommandIdentifier 51 | $(PRODUCT_BUNDLE_IDENTIFIER).PropertyLazyLoad 52 | XCSourceEditorCommandName 53 | PropertyLazyLoad 54 | 55 | 56 | XCSourceEditorCommandClassName 57 | SourceEditorCommand 58 | XCSourceEditorCommandIdentifier 59 | $(PRODUCT_BUNDLE_IDENTIFIER).EnumLazyIfelse 60 | XCSourceEditorCommandName 61 | EnumLazyIfelse 62 | 63 | 64 | XCSourceEditorExtensionPrincipalClass 65 | SourceEditorExtension 66 | 67 | NSExtensionPointIdentifier 68 | com.apple.dt.Xcode.extension.source-editor 69 | 70 | NSHumanReadableCopyright 71 | Copyright © 2024年 段志巍. All rights reserved. 72 | 73 | 74 | -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/xcshareddata/xcschemes/AutoLazyLoad.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /LazyLoad/DzwClassInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // DzwClassInfo.m 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2022/1/11. 6 | // Copyright © 2022 dzw. All rights reserved. 7 | // 8 | 9 | #import "DzwClassInfo.h" 10 | #import "DzwJsonFormatManager.h" 11 | 12 | @implementation DzwClassInfo 13 | 14 | - (instancetype)initWithClassNameKey:(NSString *)classNameKey ClassName:(NSString *)className classDic:(NSDictionary *)classDic 15 | { 16 | self = [super init]; 17 | if (self) { 18 | self.classNameKey = classNameKey; 19 | self.className = className; 20 | self.classDic = classDic; 21 | } 22 | return self; 23 | } 24 | 25 | - (NSMutableDictionary *)propertyClassDic{ 26 | if (!_propertyClassDic) { 27 | _propertyClassDic = [NSMutableDictionary dictionary]; 28 | } 29 | return _propertyClassDic; 30 | } 31 | 32 | - (NSMutableDictionary *)propertyArrayDic{ 33 | if (!_propertyArrayDic) { 34 | _propertyArrayDic = [NSMutableDictionary dictionary]; 35 | } 36 | return _propertyArrayDic; 37 | } 38 | 39 | - (NSArray *)atClassArray{ 40 | NSMutableArray *result = [NSMutableArray array]; 41 | [self.propertyClassDic enumerateKeysAndObjectsUsingBlock:^(id key, DzwClassInfo *classInfo, BOOL *stop) { 42 | [result addObject:classInfo]; 43 | [result addObjectsFromArray:classInfo.atClassArray]; 44 | }]; 45 | 46 | [self.propertyArrayDic enumerateKeysAndObjectsUsingBlock:^(id key, DzwClassInfo *classInfo, BOOL *stop) { 47 | // if ([ESJsonFormatSetting defaultSetting].useGeneric) { 48 | [result addObject:classInfo]; 49 | // } 50 | [result addObjectsFromArray:classInfo.atClassArray]; 51 | }]; 52 | 53 | return [result copy]; 54 | } 55 | 56 | - (NSString *)atClassContent{ 57 | NSArray *atClassArray = self.atClassArray; 58 | if (atClassArray.count==0) { 59 | return @""; 60 | } 61 | 62 | NSMutableArray *array = [NSMutableArray arrayWithArray:atClassArray]; 63 | 64 | NSMutableString *resultStr = [NSMutableString stringWithFormat:@"@class "]; 65 | for (DzwClassInfo *classInfo in array) { 66 | [resultStr appendFormat:@"%@,",classInfo.className]; 67 | } 68 | 69 | if ([resultStr hasSuffix:@","]) { 70 | resultStr = [NSMutableString stringWithString:[resultStr substringToIndex:resultStr.length-1]]; 71 | } 72 | [resultStr appendString:@";"]; 73 | return resultStr; 74 | } 75 | 76 | - (NSString *)propertyContent{ 77 | return [DzwJsonFormatManager parsePropertyContentWithClassInfo:self]; 78 | } 79 | 80 | - (NSString *)classContentForH{ 81 | return [DzwJsonFormatManager parseClassHeaderContentWithClassInfo:self]; 82 | } 83 | 84 | - (NSString *)classInsertTextViewContentForH{ 85 | NSMutableString *result = [NSMutableString stringWithFormat:@""]; 86 | for (NSString *key in self.propertyClassDic) { 87 | DzwClassInfo *classInfo = self.propertyClassDic[key]; 88 | [result appendFormat:@"\n%@\n",classInfo.classContentForH]; 89 | [result appendString:classInfo.classInsertTextViewContentForH]; 90 | } 91 | 92 | for (NSString *key in self.propertyArrayDic) { 93 | DzwClassInfo *classInfo = self.propertyArrayDic[key]; 94 | [result appendFormat:@"\n%@\n",classInfo.classContentForH]; 95 | [result appendString:classInfo.classInsertTextViewContentForH]; 96 | } 97 | return result; 98 | } 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/xcuserdata/Jason.xcuserdatad/xcschemes/AutoLazyLoad.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/xcshareddata/xcschemes/LazyLoad.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | 10 | 16 | 22 | 23 | 24 | 30 | 36 | 37 | 38 | 39 | 40 | 45 | 46 | 47 | 48 | 61 | 65 | 66 | 67 | 73 | 74 | 75 | 76 | 84 | 86 | 92 | 93 | 94 | 95 | 97 | 98 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/xcuserdata/Jason.xcuserdatad/xcschemes/LazyLoad.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | 10 | 16 | 22 | 23 | 24 | 30 | 36 | 37 | 38 | 39 | 40 | 45 | 46 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 70 | 72 | 78 | 79 | 80 | 81 | 82 | 83 | 90 | 92 | 98 | 99 | 100 | 101 | 103 | 104 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /LazyLoad/JsonLazyProperty.m: -------------------------------------------------------------------------------- 1 | // 2 | // JsonLazyProperty.m 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2022/1/11. 6 | // Copyright © 2022 dzw. All rights reserved. 7 | // 8 | 9 | #import "JsonLazyProperty.h" 10 | #import "DzwClassInfo.h" 11 | #import "DzwJsonFormatManager.h" 12 | #import 13 | 14 | NSString * _Nonnull const kJsonLazyProperty = @"JsonLazyProperty"; 15 | NSString * _Nonnull const kJsonRootClassName = @"kJsonRootClassName"; 16 | 17 | @interface JsonLazyProperty () 18 | @property (nonatomic, strong) XCSourceTextBuffer *buffer; 19 | @property (nonatomic, copy) void(^completionHandler)(NSError * _Nullable nilOrError); 20 | @property (nonatomic) BOOL isSwift; 21 | @end 22 | 23 | @implementation JsonLazyProperty 24 | + (void)JSON2Property:(XCSourceEditorCommandInvocation *)invocation completionHandler:(void (^)(NSError * _Nullable nilOrError))completionHandler{ 25 | JsonLazyProperty *json2p = [JsonLazyProperty new]; 26 | json2p.buffer = invocation.buffer; 27 | json2p.completionHandler = completionHandler; 28 | json2p.isSwift = [invocation.buffer.contentUTI rangeOfString:@"swift"].length != 0; 29 | 30 | 31 | NSString *jsonString = @""; 32 | XCSourceTextRange *range = invocation.buffer.selections.firstObject; 33 | for (NSInteger i=range.start.line; i<=range.end.line; i++) { 34 | if (i"]; 92 | classInfo = [[DzwClassInfo alloc] initWithClassNameKey:kJsonRootClassName ClassName:kJsonRootClassName classDic:dic]; 93 | classInfo.isSwift = self.isSwift; 94 | [self dealPropertyNameWithClassInfo:classInfo]; 95 | } 96 | return classInfo; 97 | } 98 | 99 | /** 100 | * 处理属性名字(用户输入属性对应字典对应类或者集合里面对应类的名字) 101 | * 102 | * @param classInfo 要处理的ClassInfo 103 | * 104 | * @return 处理完毕的ClassInfo 105 | */ 106 | - (DzwClassInfo *)dealPropertyNameWithClassInfo:(DzwClassInfo *)classInfo{ 107 | 108 | NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithDictionary:classInfo.classDic]; 109 | for (NSString *key in dic) { 110 | //取出的可能是NSDictionary或者NSArray 111 | id obj = dic[key]; 112 | if ([obj isKindOfClass:[NSArray class]] || [obj isKindOfClass:[NSDictionary class]]) { 113 | if ([obj isKindOfClass:[NSArray class]]) { 114 | //May be 'NSString',will crash 115 | if (!([[obj firstObject] isKindOfClass:[NSDictionary class]] || [[obj firstObject] isKindOfClass:[NSArray class]])) { 116 | continue; 117 | } 118 | } 119 | 120 | NSString *childClassName = [key.capitalizedString stringByAppendingString:@"Model"]; 121 | //如果当前obj是 NSDictionary 或者 NSArray,继续向下遍历 122 | if ([obj isKindOfClass:[NSDictionary class]]) { 123 | DzwClassInfo *childClassInfo = [[DzwClassInfo alloc] initWithClassNameKey:key ClassName:childClassName classDic:obj]; 124 | childClassInfo.isSwift = classInfo.isSwift; 125 | [self dealPropertyNameWithClassInfo:childClassInfo]; 126 | //设置classInfo里面属性对应class 127 | [classInfo.propertyClassDic setObject:childClassInfo forKey:key]; 128 | }else if([obj isKindOfClass:[NSArray class]]){ 129 | //如果是 NSArray 取出第一个元素向下遍历 130 | NSArray *array = obj; 131 | if (array.firstObject) { 132 | NSObject *obj = [array firstObject]; 133 | //May be 'NSString',will crash 134 | if ([obj isKindOfClass:[NSDictionary class]]) { 135 | DzwClassInfo *childClassInfo = [[DzwClassInfo alloc] initWithClassNameKey:key ClassName:childClassName classDic:(NSDictionary *)obj]; 136 | childClassInfo.isSwift = classInfo.isSwift; 137 | [self dealPropertyNameWithClassInfo:childClassInfo]; 138 | //设置classInfo里面属性类型为 NSArray 情况下,NSArray 内部元素类型的对应的class 139 | [classInfo.propertyArrayDic setObject:childClassInfo forKey:key]; 140 | } 141 | } 142 | } 143 | } 144 | } 145 | return classInfo; 146 | } 147 | 148 | -(void)outputResult:(DzwClassInfo*)info{ 149 | DzwClassInfo *classInfo = info; 150 | 151 | XCSourceTextRange *range = self.buffer.selections.firstObject; 152 | [self.buffer.lines removeObjectsInRange:NSMakeRange(range.start.line, range.end.line-range.start.line+1)]; 153 | 154 | //先添加主类的属性 155 | [self.buffer.lines insertObject:classInfo.propertyContent atIndex:range.start.line]; 156 | 157 | //再添加把其他类的的字符串拼接到最后面 158 | [self.buffer.lines insertObject:classInfo.classInsertTextViewContentForH atIndex:self.buffer.lines.count]; 159 | 160 | if (!info.isSwift) { 161 | //@class 162 | NSString *atClassContent = classInfo.atClassContent; 163 | NSInteger index = -1; 164 | for (int i=0; i0) { 167 | index = i; 168 | break; 169 | } 170 | } 171 | if (index!=-1 && atClassContent.length>0) { 172 | [self.buffer.lines insertObject:[NSString stringWithFormat:@"\n%@\n",atClassContent] atIndex:index]; 173 | } 174 | } 175 | 176 | XCSourceTextRange *selection = [[XCSourceTextRange alloc] initWithStart:XCSourceTextPositionMake(0, 0) end:XCSourceTextPositionMake(0, 0)]; 177 | [self.buffer.selections removeAllObjects]; 178 | [self.buffer.selections insertObject:selection atIndex:0]; 179 | } 180 | 181 | @end 182 | -------------------------------------------------------------------------------- /LazyLoad/DzwJsonFormatManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // DzwJsonFormatManager.m 3 | // LazyLoad 4 | // 5 | // Created by dzw on 20/11/28. 6 | // Copyright (c) 2020年 dzw. All rights reserved. 7 | // 8 | 9 | #import "DzwJsonFormatManager.h" 10 | #import "DzwClassInfo.h" 11 | #import 12 | 13 | #define ESUppercaseKeyWords @[@"id"] 14 | 15 | @interface DzwJsonFormatManager() 16 | 17 | @end 18 | @implementation DzwJsonFormatManager 19 | 20 | + (NSString *)parsePropertyContentWithClassInfo:(DzwClassInfo *)classInfo{ 21 | NSMutableString *resultStr = [NSMutableString string]; 22 | NSDictionary *dic = classInfo.classDic; 23 | [dic enumerateKeysAndObjectsUsingBlock:^(id key, NSObject *obj, BOOL *stop) { 24 | if (classInfo.isSwift) { 25 | [resultStr appendFormat:@"%@\n",[self formatSwiftWithKey:key value:obj classInfo:classInfo]]; 26 | }else{ 27 | [resultStr appendFormat:@"%@\n",[self formatObjcWithKey:key value:obj classInfo:classInfo]]; 28 | } 29 | }]; 30 | return resultStr; 31 | } 32 | 33 | /** 34 | * 格式化OC属性字符串 35 | * 36 | * @param key JSON里面key字段 37 | * @param value JSON里面key对应的NSDiction或者NSArray 38 | * @param classInfo 类信息 39 | * 40 | * atreturn 41 | */ 42 | + (NSString *)formatObjcWithKey:(NSString *)key value:(NSObject *)value classInfo:(DzwClassInfo *)classInfo{ 43 | NSString *qualifierStr = @"copy"; 44 | NSString *typeStr = @"NSString"; 45 | //判断大小写 46 | if ([ESUppercaseKeyWords containsObject:key] /*&& [ESJsonFormatSetting defaultSetting].uppercaseKeyWordForId*/) { 47 | key = [key uppercaseString]; 48 | } 49 | if ([value isKindOfClass:[NSString class]]) { 50 | return [NSString stringWithFormat:@"@property (nonatomic, %@) %@ *%@;",qualifierStr,typeStr,key]; 51 | }else if([value isKindOfClass:[@(YES) class]]){ 52 | //the 'NSCFBoolean' is private subclass of 'NSNumber' 53 | qualifierStr = @"assign"; 54 | typeStr = @"BOOL"; 55 | return [NSString stringWithFormat:@"@property (nonatomic, %@) %@ %@;",qualifierStr,typeStr,key]; 56 | }else if([value isKindOfClass:[NSNumber class]]){ 57 | qualifierStr = @"assign"; 58 | NSString *valueStr = [NSString stringWithFormat:@"%@",value]; 59 | if ([valueStr rangeOfString:@"."].location!=NSNotFound){ 60 | typeStr = @"CGFloat"; 61 | }else{ 62 | NSNumber *valueNumber = (NSNumber *)value; 63 | if ([valueNumber longValue]<2147483648) { 64 | typeStr = @"NSInteger"; 65 | }else{ 66 | typeStr = @"long long"; 67 | } 68 | } 69 | return [NSString stringWithFormat:@"@property (nonatomic, %@) %@ %@;",qualifierStr,typeStr,key]; 70 | }else if([value isKindOfClass:[NSArray class]]){ 71 | NSArray *array = (NSArray *)value; 72 | 73 | //May be 'NSString',will crash 74 | NSString *genericTypeStr = @""; 75 | NSObject *firstObj = [array firstObject]; 76 | if ([firstObj isKindOfClass:[NSDictionary class]]) { 77 | DzwClassInfo *childInfo = classInfo.propertyArrayDic[key]; 78 | genericTypeStr = [NSString stringWithFormat:@"<%@ *>",childInfo.className]; 79 | }else if ([firstObj isKindOfClass:[NSString class]]){ 80 | genericTypeStr = @""; 81 | }else if ([firstObj isKindOfClass:[NSNumber class]]){ 82 | genericTypeStr = @""; 83 | } 84 | 85 | qualifierStr = @"strong"; 86 | typeStr = @"NSArray"; 87 | // if ([ESJsonFormatSetting defaultSetting].useGeneric && [ESUtils isXcode7AndLater]) { 88 | return [NSString stringWithFormat:@"@property (nonatomic, %@) %@%@ *%@;",qualifierStr,typeStr,genericTypeStr,key]; 89 | // } 90 | return [NSString stringWithFormat:@"@property (nonatomic, %@) %@ *%@;",qualifierStr,typeStr,key]; 91 | }else if ([value isKindOfClass:[NSDictionary class]]){ 92 | qualifierStr = @"strong"; 93 | DzwClassInfo *childInfo = classInfo.propertyClassDic[key]; 94 | typeStr = childInfo.className; 95 | if (!typeStr) { 96 | typeStr = [key capitalizedString]; 97 | } 98 | return [NSString stringWithFormat:@"@property (nonatomic, %@) %@ *%@;",qualifierStr,typeStr,key]; 99 | } 100 | return [NSString stringWithFormat:@"@property (nonatomic, %@) %@ *%@;",qualifierStr,typeStr,key]; 101 | } 102 | 103 | 104 | /** 105 | * 格式化Swift属性字符串 106 | * 107 | * @param key JSON里面key字段 108 | * @param value JSON里面key对应的NSDiction或者NSArray 109 | * @param classInfo 类信息 110 | * 111 | * atreturn 112 | */ 113 | + (NSString *)formatSwiftWithKey:(NSString *)key value:(NSObject *)value classInfo:(DzwClassInfo *)classInfo{ 114 | NSString *typeStr = @"String"; 115 | //判断大小写 116 | if ([ESUppercaseKeyWords containsObject:key] /*&& [ESJsonFormatSetting defaultSetting].uppercaseKeyWordForId*/) { 117 | key = [key uppercaseString]; 118 | } 119 | if ([value isKindOfClass:[NSString class]]) { 120 | return [NSString stringWithFormat:@" var %@: %@ = \"\"", key, typeStr]; 121 | }else if([value isKindOfClass:[@(YES) class]]){ 122 | typeStr = @"Bool"; 123 | return [NSString stringWithFormat:@" var %@: %@ = false", key, typeStr]; 124 | }else if([value isKindOfClass:[NSNumber class]]){ 125 | NSString *valueStr = [NSString stringWithFormat:@"%@", value]; 126 | if ([valueStr rangeOfString:@"."].location!=NSNotFound){ 127 | typeStr = @"Double"; 128 | }else{ 129 | typeStr = @"Int"; 130 | } 131 | return [NSString stringWithFormat:@" var %@: %@ = 0", key, typeStr]; 132 | }else if([value isKindOfClass:[NSArray class]]){ 133 | DzwClassInfo *childInfo = classInfo.propertyArrayDic[key]; 134 | NSString *type = childInfo.className; 135 | return [NSString stringWithFormat:@" var %@: [%@] = [%@]()", key, type?:@"String", type?:@"String"]; 136 | }else if ([value isKindOfClass:[NSDictionary class]]){ 137 | DzwClassInfo *childInfo = classInfo.propertyClassDic[key]; 138 | typeStr = childInfo.className; 139 | if (!typeStr) { 140 | typeStr = [key capitalizedString]; 141 | } 142 | return [NSString stringWithFormat:@" var %@: %@ = %@()", key, typeStr, typeStr]; 143 | } 144 | return [NSString stringWithFormat:@" var %@: %@ = \"\"", key, typeStr]; 145 | } 146 | 147 | + (NSString *)parseClassHeaderContentWithClassInfo:(DzwClassInfo *)classInfo{ 148 | if (classInfo.isSwift) { 149 | return [self parseClassContentForSwiftWithClassInfo:classInfo]; 150 | }else{ 151 | return [self parseClassHeaderContentForOjbcWithClassInfo:classInfo]; 152 | } 153 | } 154 | 155 | /** 156 | * 解析.h文件内容--Objc 157 | * 158 | * @param classInfo 类信息 159 | * 160 | * atreturn 161 | */ 162 | + (NSString *)parseClassHeaderContentForOjbcWithClassInfo:(DzwClassInfo *)classInfo{ 163 | NSMutableString *result = [NSMutableString stringWithFormat:@"@interface %@ : NSObject\n\n",classInfo.className]; 164 | [result appendString:classInfo.propertyContent]; 165 | [result appendString:@"\n@end"]; 166 | return [result copy]; 167 | } 168 | 169 | /** 170 | * 解析.swift文件内容--Swift 171 | * 172 | * @param classInfo 类信息 173 | * 174 | * atreturn 175 | */ 176 | + (NSString *)parseClassContentForSwiftWithClassInfo:(DzwClassInfo *)classInfo{ 177 | 178 | NSArray *pathes = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 179 | NSString *path = [pathes.firstObject stringByAppendingPathComponent:@"SuperClass.txt"]; 180 | NSString *superClass = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; 181 | if (superClass.length == 0) { 182 | superClass = @"NSObject"; 183 | } 184 | 185 | NSMutableString *result = [NSMutableString stringWithFormat:@"class %@: %@ {\n\n",classInfo.className, superClass]; 186 | [result appendString:classInfo.propertyContent]; 187 | [result appendString:@"\n}"]; 188 | return [result copy]; 189 | } 190 | 191 | 192 | @end 193 | -------------------------------------------------------------------------------- /LazyLoad/EnumLazyIfelse.m: -------------------------------------------------------------------------------- 1 | // 2 | // EnumLazyIfelse.m 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2024/7/12. 6 | // Copyright © 2024 dzw. All rights reserved. 7 | // 8 | 9 | #import "EnumLazyIfelse.h" 10 | #import 11 | 12 | NSString * _Nonnull const kEnumLazyIfelse = @"EnumLazyIfelse"; 13 | 14 | @implementation EnumLazyIfelse 15 | 16 | + (void)enum2ifelse:(XCSourceEditorCommandInvocation *)invocation{ 17 | NSLog(@"enum2ifelse:---- 【%@】",invocation); 18 | NSString *symbolString = @""; 19 | NSMutableString *selectString = [[NSMutableString alloc] init]; 20 | NSInteger endLine = 0; 21 | for (XCSourceTextRange *range in invocation.buffer.selections) { 22 | NSInteger startLine = range.start.line; 23 | NSInteger startColumn = range.start.column; 24 | endLine = range.end.line; 25 | NSInteger endColumn = range.end.column; 26 | for (NSInteger index = startLine; index <= endLine ;index ++){ 27 | NSString *line = invocation.buffer.lines[index]; 28 | if (line == nil) { 29 | line = @" "; 30 | } 31 | if ([line containsString:@"//"]||[line containsString:@"/*"]) { 32 | NSArray *codeAnalysis; 33 | if ([line containsString:@"*/"]) {//注释使用的是 '/* */' 34 | codeAnalysis = [line componentsSeparatedByString:@"/*"]; 35 | }else if ([line containsString:@"///"]) {//注释使用的是 '///' 36 | line = [line stringByReplacingOccurrencesOfString:@"///" withString:@"//"]; 37 | codeAnalysis = [line componentsSeparatedByString:@"//"]; 38 | }else{//注释使用的是 '//' 39 | codeAnalysis = [line componentsSeparatedByString:@"//"]; 40 | } 41 | NSString *commentString = codeAnalysis.lastObject; 42 | if (codeAnalysis.count==2) { 43 | line = codeAnalysis.count>0?[codeAnalysis.firstObject stringByReplacingOccurrencesOfString:@" " withString:@""]:line; 44 | }else{ 45 | } 46 | }else{ 47 | 48 | } 49 | if (index == endLine && line.length >= endColumn) { 50 | NSRange lineRange = NSMakeRange(0, endColumn); 51 | line = [line substringWithRange:lineRange]; 52 | } 53 | 54 | if (index == startLine && line.length > startColumn) { 55 | NSRange lineRange = NSMakeRange(startColumn, line.length - startColumn); 56 | line = [line substringWithRange:lineRange]; 57 | } 58 | 59 | [selectString appendString:line]; 60 | if (endLine > startLine && index != endLine) { 61 | [selectString appendString:@"\n"]; 62 | } 63 | } 64 | } 65 | symbolString = [selectString copy]; 66 | if(symbolString.length != 0){ 67 | NSString *finalStr = [self duelWithString:symbolString ]; 68 | [self writePasteboardWithString:finalStr]; 69 | }else{ 70 | NSAlert *alert = [[NSAlert alloc] init]; 71 | [alert setMessageText:@"解析失败"]; 72 | [alert setInformativeText:[@"错误:" stringByAppendingFormat:@"enum内容解析出来的内容为空"]]; 73 | [alert addButtonWithTitle:@"好的"]; 74 | alert.window.level = NSStatusWindowLevel; 75 | 76 | [alert.window makeKeyAndOrderFront:alert.window]; 77 | } 78 | } 79 | 80 | + (NSString *)duelWithString:(NSString *)symbolString{ 81 | 82 | if (([[symbolString lowercaseString] rangeOfString:@"enum "].length > 0) || [[symbolString lowercaseString] rangeOfString:@"ns_enum"].length > 0){ 83 | 84 | BOOL isSwift = NO; 85 | if ([[symbolString lowercaseString] rangeOfString:@" case "].length > 0){ 86 | isSwift = YES; 87 | } 88 | symbolString = [[symbolString componentsSeparatedByString:@"::"] lastObject]; 89 | 90 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@" case " withString:@""]; 91 | 92 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"^enum\\s+" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, symbolString.length)]; 93 | 94 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"^\\((.*)\\)$" withString:@"$1" options:NSRegularExpressionSearch range: NSMakeRange(0, symbolString.length)]; 95 | 96 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"=.*?," withString:@"," options:NSRegularExpressionSearch range:NSMakeRange(0, symbolString.length)]; 97 | 98 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"=.*?\n" withString:@"," options:NSRegularExpressionSearch range:NSMakeRange(0, symbolString.length)]; 99 | 100 | if (isSwift) { 101 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"\n" withString:@"," options:NSRegularExpressionSearch range:NSMakeRange(0, symbolString.length)]; 102 | }else{ 103 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"\n" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, symbolString.length)]; 104 | } 105 | 106 | NSRange range = [symbolString rangeOfString:@"\\{.*?\\}" options:NSRegularExpressionSearch]; 107 | if (range.location != NSNotFound) { 108 | symbolString = [symbolString substringWithRange:range]; 109 | } 110 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"{" withString:@""]; 111 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"}" withString:@""]; 112 | 113 | NSArray *symbols = [symbolString componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]]; 114 | 115 | if (isSwift) { 116 | NSAlert *alert = [[NSAlert alloc] init]; 117 | [alert setMessageText:@"解析失败"]; 118 | [alert setInformativeText:[@"" stringByAppendingFormat:@"暂未支持swift"]]; 119 | [alert addButtonWithTitle:@"好的"]; 120 | alert.window.level = NSStatusWindowLevel; 121 | 122 | [alert.window makeKeyAndOrderFront:alert.window]; 123 | 124 | }else{ 125 | NSString *first = [symbols objectAtIndex:0]; 126 | NSString *ifStr = [NSString stringWithFormat:@"if (<#EnumType#> == %@){\n\t<#statements#>\n}",first]; 127 | NSString *end = @"else{\n\t<#statements#>}\n"; 128 | 129 | NSMutableString *stringFinal = [[NSMutableString alloc] init]; 130 | for (NSUInteger index = 0;index < [symbols count];index ++) { 131 | //case 132 | NSString *sub = [symbols objectAtIndex:index]; 133 | if (sub.length <= 0) { 134 | continue; 135 | } 136 | if(index == 0){ 137 | [stringFinal appendString:ifStr]; 138 | continue; 139 | } 140 | sub = [[sub stringByReplacingOccurrencesOfString:@" " withString:@""] stringByReplacingOccurrencesOfString:@"\n" withString:@""]; 141 | 142 | if (sub.length > 0) {//尾部增加注释 143 | NSString *caseStr = [NSString stringWithFormat:@"else if (<#EnumType#> == %@){\n\t<#statements#>\n}",sub]; 144 | [stringFinal appendString:caseStr]; 145 | } 146 | } 147 | 148 | if (stringFinal.length > 0) { 149 | NSString *stringFinalF = [NSString stringWithFormat:@"%@%@",stringFinal,end]; 150 | return stringFinalF; 151 | } 152 | } 153 | } 154 | return @""; 155 | } 156 | 157 | + (void)writePasteboardWithString:(NSString *)aString{ 158 | NSPasteboard *aPastenboard = [NSPasteboard generalPasteboard]; 159 | [aPastenboard clearContents]; 160 | NSData *aData = [aString dataUsingEncoding:NSUTF8StringEncoding]; 161 | [aPastenboard setData:aData forType:NSPasteboardTypeString]; 162 | 163 | } 164 | @end 165 | -------------------------------------------------------------------------------- /LazyLoad/PropertyLazyLoad.m: -------------------------------------------------------------------------------- 1 | // 2 | // LazyLoad.m 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2019/12/24. 6 | // Copyright © 2019 dzw. All rights reserved. 7 | // 8 | 9 | #import "PropertyLazyLoad.h" 10 | 11 | typedef NS_ENUM(NSInteger, AdaptLanguageTarget) { 12 | AdaptLanguageTargetObjc, 13 | AdaptLanguageTargetSwift, 14 | AdaptLanguageTargetOther 15 | }; 16 | 17 | NSString * const kPropertyLazyLoad = @"PropertyLazyLoad"; 18 | @interface PropertyLazyLoad () 19 | 20 | @property (nonatomic, strong)XCSourceEditorCommandInvocation *invocation; 21 | 22 | @end 23 | 24 | @implementation PropertyLazyLoad 25 | 26 | + (void)lazyLoadWithInvocation:(XCSourceEditorCommandInvocation *)invocation{ 27 | // NSLog(@"%@",invocation.buffer.lines); 28 | for (XCSourceTextRange *range in invocation.buffer.selections) { 29 | NSInteger startLine = range.start.line; 30 | NSInteger endLine = range.end.line; 31 | NSMutableArray * selectLines = [self selectLinesWithStart:startLine endLine:endLine invocation:invocation]; 32 | for (int i = 0 ; i < selectLines.count ; i++) { 33 | NSString * string = selectLines[i]; 34 | //排除空字符串 35 | if(string == nil||[string isEqualToString:@""]){ 36 | continue; 37 | } 38 | AdaptLanguageTarget target = [self typeJudgeWithString:string]; 39 | if (target == AdaptLanguageTargetOther) { 40 | // NSLog(@"不知道目标语言是什么"); 41 | continue; 42 | } 43 | NSString * getterResult =@""; 44 | //objc 45 | if (target == AdaptLanguageTargetObjc) { 46 | // NSLog(@"目标语言是OC"); 47 | getterResult = [self createObjcGetter:string]; 48 | NSInteger implementationEndLine = [self findEndLine:invocation.buffer.lines selectionEndLine:endLine]; 49 | if (implementationEndLine <= 1) { 50 | continue; 51 | } 52 | [invocation.buffer.lines insertObject:getterResult atIndex:implementationEndLine]; 53 | }else{ 54 | //swift 55 | getterResult = [self createSwiftGetter:string]; 56 | if (!getterResult || [getterResult isEqualToString:@""]) { 57 | continue; 58 | } 59 | //当前选中的行号位置 清除原来的东西 添加懒加载代码 60 | NSInteger currentLine = range.start.line; 61 | invocation.buffer.lines[currentLine] = @""; 62 | [invocation.buffer.lines insertObject:getterResult atIndex:currentLine]; 63 | } 64 | } 65 | } 66 | } 67 | 68 | - (void)lazyLoadInvocation:(XCSourceEditorCommandInvocation *)invocation{ 69 | 70 | } 71 | 72 | 73 | //判断是什么语言 74 | + (AdaptLanguageTarget)typeJudgeWithString:(NSString *)string{ 75 | 76 | if ([self targetString:string isContainString:@"@property"]) { 77 | // NSLog(@"1 oc"); 78 | return AdaptLanguageTargetObjc; 79 | } 80 | if([self targetString:string isContainString:@"var "]||[self targetString:string isContainString:@"let "]){ 81 | // NSLog(@"2 swift"); 82 | return AdaptLanguageTargetSwift; 83 | } 84 | return AdaptLanguageTargetOther; 85 | } 86 | 87 | #pragma mark - 写objcGetter 88 | + (NSString*)createObjcGetter:(NSString*)sourceStr{ 89 | NSString *resultStr; 90 | NSString *className = [self targetString:sourceStr getStringWithOutSpaceBetweenString1:@")" string2:@"*"]; 91 | if ([className isEqualToString:@""]) { 92 | return @""; 93 | } 94 | 95 | NSString *propertyName =[self targetString:sourceStr getStringWithOutSpaceBetweenString1:@"*" string2:@";"]; 96 | if ([propertyName isEqualToString:@""]) { 97 | return @""; 98 | } 99 | 100 | //成员变量带下划线 101 | NSString *instancePName=[NSString stringWithFormat:@"_%@",propertyName]; 102 | 103 | NSString *line1 = [NSString stringWithFormat:@"\n- (%@ *)%@{",className,propertyName]; 104 | NSString *line2 = [NSString stringWithFormat:@"\n if(!%@){",instancePName]; 105 | NSString *line3 = [NSString stringWithFormat:@"\n %@ = [[%@ alloc]init];",instancePName,className]; 106 | NSString *line4 = [NSString stringWithFormat:@"\n }"]; 107 | NSString *line5 = [NSString stringWithFormat:@"\n return %@;",instancePName]; 108 | NSString *line6 = [NSString stringWithFormat:@"\n}"]; 109 | 110 | resultStr = [NSString stringWithFormat:@"%@%@%@%@%@%@",line1,line2,line3,line4,line5,line6]; 111 | 112 | return resultStr; 113 | } 114 | 115 | + (NSString *)createSwiftGetter:(NSString*)sourceStr{ 116 | NSString *resultStr = @""; 117 | //取类名 有等号或者有option 118 | NSString * className = @""; 119 | NSString * typeName = @""; 120 | if ([self targetString:sourceStr isContainString:@"="] && [self targetString:sourceStr isContainString:@")"]) { 121 | className = [self targetString:sourceStr getStringWithOutSpaceBetweenString1:@"=" string2:@"("]; 122 | if ([self targetString:sourceStr isContainString:@":"]) { 123 | typeName = [self targetString:sourceStr getStringWithOutSpaceBetweenString1:@"var" string2:@":"]; 124 | }else{ 125 | 126 | typeName = [self targetString:sourceStr getStringWithOutSpaceBetweenString1:@"var" string2:@"="]; 127 | } 128 | }else if ([self targetString:sourceStr isContainString:@":"] &&[self targetString:sourceStr isContainString:@"!"]){ 129 | className =[self targetString:sourceStr getStringWithOutSpaceBetweenString1:@":" string2:@"!"]; 130 | typeName =[self targetString:sourceStr getStringWithOutSpaceBetweenString1:@"var" string2:@":"]; 131 | }else{ 132 | return nil; 133 | } 134 | if ([className isEqualToString:@""]) { 135 | return nil; 136 | } 137 | if ([typeName isEqualToString:@""]) { 138 | return nil; 139 | } 140 | // 带块语法的lazy load 141 | NSString * line1 = [NSString stringWithFormat:@"\tlazy var %@ : %@ = {", typeName, className]; 142 | NSString * line2 = [NSString stringWithFormat:@"\n\t\tlet object = %@()",className]; 143 | NSString * line3 = [NSString stringWithFormat:@"\n\t\treturn object"]; 144 | NSString * line4 = [NSString stringWithFormat:@"\n\t}()"]; 145 | resultStr = [NSString stringWithFormat:@"%@%@%@%@",line1,line2,line3,line4]; 146 | return resultStr; 147 | } 148 | 149 | //字符串操作 150 | + (BOOL)targetString:(NSString *)string isContainString:(NSString *)subString { 151 | return [string rangeOfString:subString].location != NSNotFound? YES: NO; 152 | } 153 | 154 | + (NSString *)targetString:(NSString *)string getStringWithOutSpaceBetweenString1:(NSString *)string1 string2:(NSString *)string2{ 155 | NSRange range=[string rangeOfString:string1]; 156 | if(range.location==NSNotFound){ 157 | //错误的格式或者对象 158 | return @""; 159 | } 160 | NSString * tempString = [string substringFromIndex:(range.location + range.length)]; 161 | range = [tempString rangeOfString:string2]; 162 | if(range.location==NSNotFound){ 163 | // NSLog(@"错误的格式或者对象"); 164 | return @""; 165 | } 166 | tempString = [tempString substringToIndex:range.location]; 167 | NSString * typeName = [tempString stringByReplacingOccurrencesOfString:@" " withString:@""]; 168 | return typeName; 169 | } 170 | 171 | //行操作 172 | + (NSInteger)findEndLine:(NSArray *)lines selectionEndLine:(NSInteger)endLine{ 173 | //找interface确认类名 174 | NSString * interfaceLine = @""; 175 | for (NSInteger i = endLine; i >= 1; i--) { 176 | if ([lines[i] rangeOfString:@"@interface"].location != NSNotFound) { 177 | interfaceLine = lines[i]; 178 | break; 179 | } 180 | } 181 | NSRange interfaceRange = [interfaceLine rangeOfString:@"@interface"]; 182 | NSRange LeftRange = [interfaceLine rangeOfString:@"("]; 183 | NSRange classWithSpaceRange = NSMakeRange(interfaceRange.location + interfaceRange.length, interfaceLine.length - interfaceRange.length - interfaceRange.location - (interfaceLine.length - LeftRange.location)); 184 | NSString * removeSpace = [interfaceLine substringWithRange:classWithSpaceRange]; 185 | NSString * classStr = [removeSpace stringByReplacingOccurrencesOfString:@" " withString:@""]; 186 | BOOL kHasfindLine = NO; 187 | for (NSInteger i = endLine; i < lines.count; i++) { 188 | if ([lines[i] rangeOfString:@"@implementation"].location != NSNotFound && 189 | [lines[i] rangeOfString:classStr].location != NSNotFound) { 190 | kHasfindLine = YES; 191 | continue; 192 | } 193 | if (kHasfindLine && [lines[i] rangeOfString:@"@end"].location != NSNotFound) { 194 | return i; 195 | } 196 | } 197 | return 0; 198 | } 199 | 200 | + (NSMutableArray *)selectLinesWithStart:(NSInteger)startLine endLine:(NSInteger)endLine invocation:(XCSourceEditorCommandInvocation *)invocation{ 201 | NSMutableArray * selectLines = [NSMutableArray arrayWithCapacity:endLine-startLine]; 202 | for (NSInteger i = startLine; i<=endLine ; i++) { 203 | [selectLines addObject:invocation.buffer.lines[i]]; 204 | } 205 | return selectLines; 206 | } 207 | 208 | @end 209 | -------------------------------------------------------------------------------- /LazyLoad/EnumLazySwitch.m: -------------------------------------------------------------------------------- 1 | // 2 | // EnumLazySwitch.m 3 | // LazyLoad 4 | // 5 | // Created by dzw on 2019/12/24. 6 | // Copyright © 2019 dzw. All rights reserved. 7 | // 8 | 9 | #import "EnumLazySwitch.h" 10 | #import 11 | #import "Toast.h" 12 | 13 | NSString * _Nonnull const kEnumLazySwitch = @"EnumLazySwitch"; 14 | @implementation EnumLazySwitch 15 | 16 | + (void)enum2Switch:(XCSourceEditorCommandInvocation *)invocation{ 17 | NSLog(@"enum2Switch:---- 【%@】",invocation); 18 | NSString *symbolString = @""; 19 | NSMutableString *selectString = [[NSMutableString alloc] init]; 20 | NSInteger endLine = 0; 21 | //comments 22 | NSMutableArray *comments = [NSMutableArray array]; 23 | for (XCSourceTextRange *range in invocation.buffer.selections) { 24 | NSInteger startLine = range.start.line; 25 | NSInteger startColumn = range.start.column; 26 | endLine = range.end.line; 27 | NSInteger endColumn = range.end.column; 28 | for (NSInteger index = startLine; index <= endLine ;index ++){ 29 | NSString *line = invocation.buffer.lines[index]; 30 | if (line == nil) { 31 | line = @" "; 32 | } 33 | if ([line containsString:@"//"]||[line containsString:@"/*"]) { 34 | NSArray *codeAnalysis; 35 | if ([line containsString:@"*/"]) {//注释使用的是 '/* */' 36 | codeAnalysis = [line componentsSeparatedByString:@"/*"]; 37 | }else if ([line containsString:@"///"]) {//注释使用的是 '///' 38 | line = [line stringByReplacingOccurrencesOfString:@"///" withString:@"//"]; 39 | codeAnalysis = [line componentsSeparatedByString:@"//"]; 40 | }else{//注释使用的是 '//' 41 | codeAnalysis = [line componentsSeparatedByString:@"//"]; 42 | } 43 | NSString *commentString = codeAnalysis.lastObject; 44 | if (codeAnalysis.count==2) { 45 | [comments addObject:codeAnalysis.count>0?[[commentString stringByReplacingOccurrencesOfString:@"/*" withString:@""] stringByReplacingOccurrencesOfString:@"*/" withString:@""]:@""]; 46 | line = codeAnalysis.count>0?[codeAnalysis.firstObject stringByReplacingOccurrencesOfString:@" " withString:@""]:line; 47 | }else{ 48 | if ([commentString containsString:@"*/"]) {// 注释 49 | [comments addObject:codeAnalysis.count>0? 50 | [[[commentString stringByReplacingOccurrencesOfString:@"/*" withString:@""] stringByReplacingOccurrencesOfString:@"*/" withString:@""]stringByReplacingOccurrencesOfString:@" " withString:@""]:@""]; 51 | line = @""; 52 | }else{ //代码 53 | line = commentString; 54 | [comments addObject:@""]; 55 | } 56 | } 57 | }else{ 58 | [comments addObject:@""]; 59 | } 60 | if (index == endLine && line.length >= endColumn) { 61 | NSRange lineRange = NSMakeRange(0, endColumn); 62 | line = [line substringWithRange:lineRange]; 63 | } 64 | 65 | if (index == startLine && line.length > startColumn) { 66 | NSRange lineRange = NSMakeRange(startColumn, line.length - startColumn); 67 | line = [line substringWithRange:lineRange]; 68 | } 69 | 70 | [selectString appendString:line]; 71 | if (endLine > startLine && index != endLine) { 72 | [selectString appendString:@"\n"]; 73 | } 74 | } 75 | } 76 | symbolString = [selectString copy]; 77 | Toast(@"a=====:%@",symbolString); 78 | if(symbolString.length != 0){ 79 | NSString *finalStr = [self duelWithString:symbolString comments:comments]; 80 | [self writePasteboardWithString:finalStr]; 81 | }else{ 82 | NSAlert *alert = [[NSAlert alloc] init]; 83 | [alert setMessageText:@"解析失败"]; 84 | [alert setInformativeText:[@"错误:" stringByAppendingFormat:@"enum内容解析出来的内容为空"]]; 85 | [alert addButtonWithTitle:@"好的"]; 86 | alert.window.level = NSStatusWindowLevel; 87 | 88 | [alert.window makeKeyAndOrderFront:alert.window]; 89 | } 90 | } 91 | 92 | + (NSString *)duelWithString:(NSString *)symbolString comments:(NSArray *)comments{ 93 | 94 | if (([[symbolString lowercaseString] rangeOfString:@"enum "].length > 0) || [[symbolString lowercaseString] rangeOfString:@"ns_enum"].length > 0){ 95 | 96 | BOOL isSwift = NO; 97 | if ([[symbolString lowercaseString] rangeOfString:@" case "].length > 0){ 98 | isSwift = YES; 99 | } 100 | symbolString = [[symbolString componentsSeparatedByString:@"::"] lastObject]; 101 | 102 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@" case " withString:@""]; 103 | 104 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"^enum\\s+" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, symbolString.length)]; 105 | 106 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"^\\((.*)\\)$" withString:@"$1" options:NSRegularExpressionSearch range: NSMakeRange(0, symbolString.length)]; 107 | 108 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"=.*?," withString:@"," options:NSRegularExpressionSearch range:NSMakeRange(0, symbolString.length)]; 109 | 110 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"=.*?\n" withString:@"," options:NSRegularExpressionSearch range:NSMakeRange(0, symbolString.length)]; 111 | 112 | if (isSwift) { 113 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"\n" withString:@"," options:NSRegularExpressionSearch range:NSMakeRange(0, symbolString.length)]; 114 | }else{ 115 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"\n" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, symbolString.length)]; 116 | } 117 | 118 | NSRange range = [symbolString rangeOfString:@"\\{.*?\\}" options:NSRegularExpressionSearch]; 119 | if (range.location != NSNotFound) { 120 | symbolString = [symbolString substringWithRange:range]; 121 | } 122 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"{" withString:@""]; 123 | symbolString = [symbolString stringByReplacingOccurrencesOfString:@"}" withString:@""]; 124 | 125 | NSArray *symbols = [symbolString componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]]; 126 | 127 | if (isSwift) { 128 | NSString *begin = @"\nswitch <#value#> {\n"; 129 | NSString *end = @" default:\n}\n"; 130 | 131 | NSMutableString *stringFinal = [[NSMutableString alloc] init]; 132 | for (NSUInteger index = 0;index < [symbols count];index ++) { 133 | NSString *sub = [symbols objectAtIndex:index]; 134 | if (sub.length > 0) { 135 | NSString *caseStr = [NSString stringWithFormat:@" case .%@:\n<#code#>\n",sub]; 136 | [stringFinal appendString:caseStr]; 137 | } 138 | } 139 | 140 | if (stringFinal.length > 0) { 141 | NSString *stringFinalF = [NSString stringWithFormat:@"%@%@%@",begin,stringFinal,end]; 142 | NSLog(@"\n%@",stringFinalF); 143 | return stringFinalF; 144 | } 145 | 146 | }else{ 147 | NSString *begin = @"\nswitch (<#EnumType#>) {\n"; 148 | NSString *end = @" default:\n break;\n}\n"; 149 | 150 | NSMutableString *stringFinal = [[NSMutableString alloc] init]; 151 | for (NSUInteger index = 0;index < [symbols count];index ++) { 152 | //case 153 | NSString *sub = [symbols objectAtIndex:index]; 154 | if (sub.length <= 0) { 155 | continue; 156 | } 157 | sub = [[sub stringByReplacingOccurrencesOfString:@" " withString:@""] stringByReplacingOccurrencesOfString:@"\n" withString:@""]; 158 | //注释 159 | NSString *singleComment = comments[index]; 160 | if (![singleComment isEqual:@""]) {//没有注释 161 | singleComment = [NSString stringWithFormat:@"//%@",singleComment]; 162 | } 163 | if (sub.length > 0) { 164 | NSString *caseStr = [NSString stringWithFormat:@"\tcase %@:%@\n\t{\n\t\t<#statements#>\n\t}\n\t\tbreak;\n",sub,singleComment]; 165 | [stringFinal appendString:caseStr]; 166 | } 167 | } 168 | 169 | if (stringFinal.length > 0) { 170 | NSString *stringFinalF = [NSString stringWithFormat:@"%@%@%@",begin,stringFinal,end]; 171 | return stringFinalF; 172 | } 173 | } 174 | } 175 | return @""; 176 | } 177 | 178 | + (void)writePasteboardWithString:(NSString *)aString{ 179 | NSPasteboard *aPastenboard = [NSPasteboard generalPasteboard]; 180 | [aPastenboard clearContents]; 181 | NSData *aData = [aString dataUsingEncoding:NSUTF8StringEncoding]; 182 | [aPastenboard setData:aData forType:NSPasteboardTypeString]; 183 | 184 | } 185 | @end 186 | -------------------------------------------------------------------------------- /AutoLazyLoad.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 043D5196278D6D1F00092D20 /* DzwJsonFormatManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 043D5194278D6D1F00092D20 /* DzwJsonFormatManager.m */; }; 11 | 043D5199278D6D2700092D20 /* DzwClassInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 043D5197278D6D2700092D20 /* DzwClassInfo.m */; }; 12 | 045B7C0926983B1400C9064B /* XcodeKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 045B7C0826983B1400C9064B /* XcodeKit.framework */; }; 13 | 045B7C0A26983B1400C9064B /* XcodeKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 045B7C0826983B1400C9064B /* XcodeKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 04CB75EE278D25AD0024860D /* JsonLazyProperty.m in Sources */ = {isa = PBXBuildFile; fileRef = 04CB75ED278D25AD0024860D /* JsonLazyProperty.m */; }; 15 | 781ED73A2C412ECB00FDBEC2 /* EnumLazyIfelse.m in Sources */ = {isa = PBXBuildFile; fileRef = 781ED7392C412ECB00FDBEC2 /* EnumLazyIfelse.m */; }; 16 | 781ED73E2C41364E00FDBEC2 /* Toast.m in Sources */ = {isa = PBXBuildFile; fileRef = 781ED73D2C41364E00FDBEC2 /* Toast.m */; }; 17 | 861F014723B1AEAF001684D8 /* PropertyLazyLoad.m in Sources */ = {isa = PBXBuildFile; fileRef = 861F014623B1AEAF001684D8 /* PropertyLazyLoad.m */; }; 18 | 861F014A23B1B07A001684D8 /* EnumLazySwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = 861F014923B1B07A001684D8 /* EnumLazySwitch.m */; }; 19 | 96F33C6D1F62B14A00973AB1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 96F33C6C1F62B14A00973AB1 /* AppDelegate.m */; }; 20 | 96F33C701F62B14A00973AB1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 96F33C6F1F62B14A00973AB1 /* main.m */; }; 21 | 96F33C731F62B14A00973AB1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 96F33C721F62B14A00973AB1 /* ViewController.m */; }; 22 | 96F33C751F62B14A00973AB1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96F33C741F62B14A00973AB1 /* Assets.xcassets */; }; 23 | 96F33C781F62B14A00973AB1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96F33C761F62B14A00973AB1 /* Main.storyboard */; }; 24 | 96F33C861F62B15400973AB1 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96F33C851F62B15400973AB1 /* Cocoa.framework */; }; 25 | 96F33C8C1F62B15400973AB1 /* SourceEditorExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 96F33C8B1F62B15400973AB1 /* SourceEditorExtension.m */; }; 26 | 96F33C8F1F62B15400973AB1 /* SourceEditorCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 96F33C8E1F62B15400973AB1 /* SourceEditorCommand.m */; }; 27 | 96F33C931F62B15400973AB1 /* LazyLoad.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 96F33C831F62B15400973AB1 /* LazyLoad.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXContainerItemProxy section */ 31 | 96F33C911F62B15400973AB1 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = 96F33C601F62B14A00973AB1 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = 96F33C821F62B15400973AB1; 36 | remoteInfo = LazyLoad; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXCopyFilesBuildPhase section */ 41 | 045B7C0B26983B1400C9064B /* Embed Frameworks */ = { 42 | isa = PBXCopyFilesBuildPhase; 43 | buildActionMask = 2147483647; 44 | dstPath = ""; 45 | dstSubfolderSpec = 10; 46 | files = ( 47 | 045B7C0A26983B1400C9064B /* XcodeKit.framework in Embed Frameworks */, 48 | ); 49 | name = "Embed Frameworks"; 50 | runOnlyForDeploymentPostprocessing = 0; 51 | }; 52 | 96F33C971F62B15400973AB1 /* Embed App Extensions */ = { 53 | isa = PBXCopyFilesBuildPhase; 54 | buildActionMask = 2147483647; 55 | dstPath = ""; 56 | dstSubfolderSpec = 13; 57 | files = ( 58 | 96F33C931F62B15400973AB1 /* LazyLoad.appex in Embed App Extensions */, 59 | ); 60 | name = "Embed App Extensions"; 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXCopyFilesBuildPhase section */ 64 | 65 | /* Begin PBXFileReference section */ 66 | 043D5194278D6D1F00092D20 /* DzwJsonFormatManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DzwJsonFormatManager.m; sourceTree = ""; }; 67 | 043D5195278D6D1F00092D20 /* DzwJsonFormatManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DzwJsonFormatManager.h; sourceTree = ""; }; 68 | 043D5197278D6D2700092D20 /* DzwClassInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DzwClassInfo.m; sourceTree = ""; }; 69 | 043D5198278D6D2700092D20 /* DzwClassInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DzwClassInfo.h; sourceTree = ""; }; 70 | 045B7C0826983B1400C9064B /* XcodeKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XcodeKit.framework; path = Library/Frameworks/XcodeKit.framework; sourceTree = DEVELOPER_DIR; }; 71 | 04CB75EC278D25AD0024860D /* JsonLazyProperty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JsonLazyProperty.h; sourceTree = ""; }; 72 | 04CB75ED278D25AD0024860D /* JsonLazyProperty.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JsonLazyProperty.m; sourceTree = ""; }; 73 | 781ED7382C412ECB00FDBEC2 /* EnumLazyIfelse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EnumLazyIfelse.h; sourceTree = ""; }; 74 | 781ED7392C412ECB00FDBEC2 /* EnumLazyIfelse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EnumLazyIfelse.m; sourceTree = ""; }; 75 | 781ED73C2C41364E00FDBEC2 /* Toast.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Toast.h; sourceTree = ""; }; 76 | 781ED73D2C41364E00FDBEC2 /* Toast.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Toast.m; sourceTree = ""; }; 77 | 861F014523B1AEAF001684D8 /* PropertyLazyLoad.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PropertyLazyLoad.h; sourceTree = ""; }; 78 | 861F014623B1AEAF001684D8 /* PropertyLazyLoad.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PropertyLazyLoad.m; sourceTree = ""; }; 79 | 861F014823B1B07A001684D8 /* EnumLazySwitch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EnumLazySwitch.h; sourceTree = ""; }; 80 | 861F014923B1B07A001684D8 /* EnumLazySwitch.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EnumLazySwitch.m; sourceTree = ""; }; 81 | 96F33C681F62B14A00973AB1 /* AutoLazyLoad.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AutoLazyLoad.app; sourceTree = BUILT_PRODUCTS_DIR; }; 82 | 96F33C6B1F62B14A00973AB1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 83 | 96F33C6C1F62B14A00973AB1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 84 | 96F33C6F1F62B14A00973AB1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 85 | 96F33C711F62B14A00973AB1 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 86 | 96F33C721F62B14A00973AB1 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 87 | 96F33C741F62B14A00973AB1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 88 | 96F33C771F62B14A00973AB1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 89 | 96F33C791F62B14A00973AB1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 90 | 96F33C831F62B15400973AB1 /* LazyLoad.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = LazyLoad.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 91 | 96F33C851F62B15400973AB1 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 92 | 96F33C891F62B15400973AB1 /* LazyLoad.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = LazyLoad.entitlements; sourceTree = ""; }; 93 | 96F33C8A1F62B15400973AB1 /* SourceEditorExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SourceEditorExtension.h; sourceTree = ""; }; 94 | 96F33C8B1F62B15400973AB1 /* SourceEditorExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SourceEditorExtension.m; sourceTree = ""; }; 95 | 96F33C8D1F62B15400973AB1 /* SourceEditorCommand.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SourceEditorCommand.h; sourceTree = ""; }; 96 | 96F33C8E1F62B15400973AB1 /* SourceEditorCommand.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SourceEditorCommand.m; sourceTree = ""; }; 97 | 96F33C901F62B15400973AB1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 98 | /* End PBXFileReference section */ 99 | 100 | /* Begin PBXFrameworksBuildPhase section */ 101 | 96F33C651F62B14A00973AB1 /* Frameworks */ = { 102 | isa = PBXFrameworksBuildPhase; 103 | buildActionMask = 2147483647; 104 | files = ( 105 | ); 106 | runOnlyForDeploymentPostprocessing = 0; 107 | }; 108 | 96F33C801F62B15400973AB1 /* Frameworks */ = { 109 | isa = PBXFrameworksBuildPhase; 110 | buildActionMask = 2147483647; 111 | files = ( 112 | 96F33C861F62B15400973AB1 /* Cocoa.framework in Frameworks */, 113 | 045B7C0926983B1400C9064B /* XcodeKit.framework in Frameworks */, 114 | ); 115 | runOnlyForDeploymentPostprocessing = 0; 116 | }; 117 | /* End PBXFrameworksBuildPhase section */ 118 | 119 | /* Begin PBXGroup section */ 120 | 043D519A278D6D2B00092D20 /* JsonLazyProperty */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 04CB75EC278D25AD0024860D /* JsonLazyProperty.h */, 124 | 04CB75ED278D25AD0024860D /* JsonLazyProperty.m */, 125 | 043D5198278D6D2700092D20 /* DzwClassInfo.h */, 126 | 043D5197278D6D2700092D20 /* DzwClassInfo.m */, 127 | 043D5195278D6D1F00092D20 /* DzwJsonFormatManager.h */, 128 | 043D5194278D6D1F00092D20 /* DzwJsonFormatManager.m */, 129 | ); 130 | name = JsonLazyProperty; 131 | sourceTree = ""; 132 | }; 133 | 043D519E278D6EB000092D20 /* PropertyLazyLoad */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 861F014523B1AEAF001684D8 /* PropertyLazyLoad.h */, 137 | 861F014623B1AEAF001684D8 /* PropertyLazyLoad.m */, 138 | ); 139 | name = PropertyLazyLoad; 140 | sourceTree = ""; 141 | }; 142 | 043D519F278D6EC300092D20 /* EnumLazySwitch */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 861F014823B1B07A001684D8 /* EnumLazySwitch.h */, 146 | 861F014923B1B07A001684D8 /* EnumLazySwitch.m */, 147 | ); 148 | name = EnumLazySwitch; 149 | sourceTree = ""; 150 | }; 151 | 781ED73B2C41363D00FDBEC2 /* Tool */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | 781ED73C2C41364E00FDBEC2 /* Toast.h */, 155 | 781ED73D2C41364E00FDBEC2 /* Toast.m */, 156 | ); 157 | name = Tool; 158 | sourceTree = ""; 159 | }; 160 | 781ED73F2C413C8000FDBEC2 /* EnumLazyIfelse */ = { 161 | isa = PBXGroup; 162 | children = ( 163 | 781ED7382C412ECB00FDBEC2 /* EnumLazyIfelse.h */, 164 | 781ED7392C412ECB00FDBEC2 /* EnumLazyIfelse.m */, 165 | ); 166 | name = EnumLazyIfelse; 167 | sourceTree = ""; 168 | }; 169 | 96F33C5F1F62B14A00973AB1 = { 170 | isa = PBXGroup; 171 | children = ( 172 | 96F33C6A1F62B14A00973AB1 /* AutoLazyLoad */, 173 | 96F33C871F62B15400973AB1 /* LazyLoad */, 174 | 96F33C841F62B15400973AB1 /* Frameworks */, 175 | 96F33C691F62B14A00973AB1 /* Products */, 176 | ); 177 | sourceTree = ""; 178 | }; 179 | 96F33C691F62B14A00973AB1 /* Products */ = { 180 | isa = PBXGroup; 181 | children = ( 182 | 96F33C681F62B14A00973AB1 /* AutoLazyLoad.app */, 183 | 96F33C831F62B15400973AB1 /* LazyLoad.appex */, 184 | ); 185 | name = Products; 186 | sourceTree = ""; 187 | }; 188 | 96F33C6A1F62B14A00973AB1 /* AutoLazyLoad */ = { 189 | isa = PBXGroup; 190 | children = ( 191 | 96F33C6B1F62B14A00973AB1 /* AppDelegate.h */, 192 | 96F33C6C1F62B14A00973AB1 /* AppDelegate.m */, 193 | 96F33C711F62B14A00973AB1 /* ViewController.h */, 194 | 96F33C721F62B14A00973AB1 /* ViewController.m */, 195 | 96F33C741F62B14A00973AB1 /* Assets.xcassets */, 196 | 96F33C761F62B14A00973AB1 /* Main.storyboard */, 197 | 96F33C791F62B14A00973AB1 /* Info.plist */, 198 | 96F33C6E1F62B14A00973AB1 /* Supporting Files */, 199 | ); 200 | path = AutoLazyLoad; 201 | sourceTree = ""; 202 | }; 203 | 96F33C6E1F62B14A00973AB1 /* Supporting Files */ = { 204 | isa = PBXGroup; 205 | children = ( 206 | 96F33C6F1F62B14A00973AB1 /* main.m */, 207 | ); 208 | name = "Supporting Files"; 209 | sourceTree = ""; 210 | }; 211 | 96F33C841F62B15400973AB1 /* Frameworks */ = { 212 | isa = PBXGroup; 213 | children = ( 214 | 045B7C0826983B1400C9064B /* XcodeKit.framework */, 215 | 96F33C851F62B15400973AB1 /* Cocoa.framework */, 216 | ); 217 | name = Frameworks; 218 | sourceTree = ""; 219 | }; 220 | 96F33C871F62B15400973AB1 /* LazyLoad */ = { 221 | isa = PBXGroup; 222 | children = ( 223 | 781ED73F2C413C8000FDBEC2 /* EnumLazyIfelse */, 224 | 781ED73B2C41363D00FDBEC2 /* Tool */, 225 | 043D519E278D6EB000092D20 /* PropertyLazyLoad */, 226 | 043D519F278D6EC300092D20 /* EnumLazySwitch */, 227 | 043D519A278D6D2B00092D20 /* JsonLazyProperty */, 228 | 96F33C8A1F62B15400973AB1 /* SourceEditorExtension.h */, 229 | 96F33C8B1F62B15400973AB1 /* SourceEditorExtension.m */, 230 | 96F33C8D1F62B15400973AB1 /* SourceEditorCommand.h */, 231 | 96F33C8E1F62B15400973AB1 /* SourceEditorCommand.m */, 232 | 96F33C901F62B15400973AB1 /* Info.plist */, 233 | 96F33C881F62B15400973AB1 /* Supporting Files */, 234 | ); 235 | path = LazyLoad; 236 | sourceTree = ""; 237 | }; 238 | 96F33C881F62B15400973AB1 /* Supporting Files */ = { 239 | isa = PBXGroup; 240 | children = ( 241 | 96F33C891F62B15400973AB1 /* LazyLoad.entitlements */, 242 | ); 243 | name = "Supporting Files"; 244 | sourceTree = ""; 245 | }; 246 | /* End PBXGroup section */ 247 | 248 | /* Begin PBXNativeTarget section */ 249 | 96F33C671F62B14A00973AB1 /* AutoLazyLoad */ = { 250 | isa = PBXNativeTarget; 251 | buildConfigurationList = 96F33C7C1F62B14A00973AB1 /* Build configuration list for PBXNativeTarget "AutoLazyLoad" */; 252 | buildPhases = ( 253 | 96F33C641F62B14A00973AB1 /* Sources */, 254 | 96F33C651F62B14A00973AB1 /* Frameworks */, 255 | 96F33C661F62B14A00973AB1 /* Resources */, 256 | 96F33C971F62B15400973AB1 /* Embed App Extensions */, 257 | ); 258 | buildRules = ( 259 | ); 260 | dependencies = ( 261 | 96F33C921F62B15400973AB1 /* PBXTargetDependency */, 262 | ); 263 | name = AutoLazyLoad; 264 | productName = AutoLazyLoad; 265 | productReference = 96F33C681F62B14A00973AB1 /* AutoLazyLoad.app */; 266 | productType = "com.apple.product-type.application"; 267 | }; 268 | 96F33C821F62B15400973AB1 /* LazyLoad */ = { 269 | isa = PBXNativeTarget; 270 | buildConfigurationList = 96F33C941F62B15400973AB1 /* Build configuration list for PBXNativeTarget "LazyLoad" */; 271 | buildPhases = ( 272 | 96F33C7F1F62B15400973AB1 /* Sources */, 273 | 96F33C801F62B15400973AB1 /* Frameworks */, 274 | 96F33C811F62B15400973AB1 /* Resources */, 275 | 045B7C0B26983B1400C9064B /* Embed Frameworks */, 276 | ); 277 | buildRules = ( 278 | ); 279 | dependencies = ( 280 | ); 281 | name = LazyLoad; 282 | productName = LazyLoad; 283 | productReference = 96F33C831F62B15400973AB1 /* LazyLoad.appex */; 284 | productType = "com.apple.product-type.xcode-extension"; 285 | }; 286 | /* End PBXNativeTarget section */ 287 | 288 | /* Begin PBXProject section */ 289 | 96F33C601F62B14A00973AB1 /* Project object */ = { 290 | isa = PBXProject; 291 | attributes = { 292 | LastUpgradeCheck = 0830; 293 | ORGANIZATIONNAME = dzw; 294 | TargetAttributes = { 295 | 96F33C671F62B14A00973AB1 = { 296 | CreatedOnToolsVersion = 8.3.3; 297 | DevelopmentTeam = 97KXK82D47; 298 | ProvisioningStyle = Automatic; 299 | }; 300 | 96F33C821F62B15400973AB1 = { 301 | CreatedOnToolsVersion = 8.3.3; 302 | DevelopmentTeam = 97KXK82D47; 303 | ProvisioningStyle = Automatic; 304 | }; 305 | }; 306 | }; 307 | buildConfigurationList = 96F33C631F62B14A00973AB1 /* Build configuration list for PBXProject "AutoLazyLoad" */; 308 | compatibilityVersion = "Xcode 3.2"; 309 | developmentRegion = English; 310 | hasScannedForEncodings = 0; 311 | knownRegions = ( 312 | English, 313 | en, 314 | Base, 315 | ); 316 | mainGroup = 96F33C5F1F62B14A00973AB1; 317 | productRefGroup = 96F33C691F62B14A00973AB1 /* Products */; 318 | projectDirPath = ""; 319 | projectRoot = ""; 320 | targets = ( 321 | 96F33C671F62B14A00973AB1 /* AutoLazyLoad */, 322 | 96F33C821F62B15400973AB1 /* LazyLoad */, 323 | ); 324 | }; 325 | /* End PBXProject section */ 326 | 327 | /* Begin PBXResourcesBuildPhase section */ 328 | 96F33C661F62B14A00973AB1 /* Resources */ = { 329 | isa = PBXResourcesBuildPhase; 330 | buildActionMask = 2147483647; 331 | files = ( 332 | 96F33C751F62B14A00973AB1 /* Assets.xcassets in Resources */, 333 | 96F33C781F62B14A00973AB1 /* Main.storyboard in Resources */, 334 | ); 335 | runOnlyForDeploymentPostprocessing = 0; 336 | }; 337 | 96F33C811F62B15400973AB1 /* Resources */ = { 338 | isa = PBXResourcesBuildPhase; 339 | buildActionMask = 2147483647; 340 | files = ( 341 | ); 342 | runOnlyForDeploymentPostprocessing = 0; 343 | }; 344 | /* End PBXResourcesBuildPhase section */ 345 | 346 | /* Begin PBXSourcesBuildPhase section */ 347 | 96F33C641F62B14A00973AB1 /* Sources */ = { 348 | isa = PBXSourcesBuildPhase; 349 | buildActionMask = 2147483647; 350 | files = ( 351 | 96F33C731F62B14A00973AB1 /* ViewController.m in Sources */, 352 | 96F33C701F62B14A00973AB1 /* main.m in Sources */, 353 | 96F33C6D1F62B14A00973AB1 /* AppDelegate.m in Sources */, 354 | ); 355 | runOnlyForDeploymentPostprocessing = 0; 356 | }; 357 | 96F33C7F1F62B15400973AB1 /* Sources */ = { 358 | isa = PBXSourcesBuildPhase; 359 | buildActionMask = 2147483647; 360 | files = ( 361 | 781ED73A2C412ECB00FDBEC2 /* EnumLazyIfelse.m in Sources */, 362 | 043D5199278D6D2700092D20 /* DzwClassInfo.m in Sources */, 363 | 043D5196278D6D1F00092D20 /* DzwJsonFormatManager.m in Sources */, 364 | 04CB75EE278D25AD0024860D /* JsonLazyProperty.m in Sources */, 365 | 96F33C8C1F62B15400973AB1 /* SourceEditorExtension.m in Sources */, 366 | 96F33C8F1F62B15400973AB1 /* SourceEditorCommand.m in Sources */, 367 | 781ED73E2C41364E00FDBEC2 /* Toast.m in Sources */, 368 | 861F014A23B1B07A001684D8 /* EnumLazySwitch.m in Sources */, 369 | 861F014723B1AEAF001684D8 /* PropertyLazyLoad.m in Sources */, 370 | ); 371 | runOnlyForDeploymentPostprocessing = 0; 372 | }; 373 | /* End PBXSourcesBuildPhase section */ 374 | 375 | /* Begin PBXTargetDependency section */ 376 | 96F33C921F62B15400973AB1 /* PBXTargetDependency */ = { 377 | isa = PBXTargetDependency; 378 | target = 96F33C821F62B15400973AB1 /* LazyLoad */; 379 | targetProxy = 96F33C911F62B15400973AB1 /* PBXContainerItemProxy */; 380 | }; 381 | /* End PBXTargetDependency section */ 382 | 383 | /* Begin PBXVariantGroup section */ 384 | 96F33C761F62B14A00973AB1 /* Main.storyboard */ = { 385 | isa = PBXVariantGroup; 386 | children = ( 387 | 96F33C771F62B14A00973AB1 /* Base */, 388 | ); 389 | name = Main.storyboard; 390 | sourceTree = ""; 391 | }; 392 | /* End PBXVariantGroup section */ 393 | 394 | /* Begin XCBuildConfiguration section */ 395 | 96F33C7A1F62B14A00973AB1 /* Debug */ = { 396 | isa = XCBuildConfiguration; 397 | buildSettings = { 398 | ALWAYS_SEARCH_USER_PATHS = NO; 399 | CLANG_ANALYZER_NONNULL = YES; 400 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 401 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 402 | CLANG_CXX_LIBRARY = "libc++"; 403 | CLANG_ENABLE_MODULES = YES; 404 | CLANG_ENABLE_OBJC_ARC = YES; 405 | CLANG_WARN_BOOL_CONVERSION = YES; 406 | CLANG_WARN_CONSTANT_CONVERSION = YES; 407 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 408 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 409 | CLANG_WARN_EMPTY_BODY = YES; 410 | CLANG_WARN_ENUM_CONVERSION = YES; 411 | CLANG_WARN_INFINITE_RECURSION = YES; 412 | CLANG_WARN_INT_CONVERSION = YES; 413 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNREACHABLE_CODE = YES; 416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 417 | CODE_SIGN_IDENTITY = "-"; 418 | COPY_PHASE_STRIP = NO; 419 | DEBUG_INFORMATION_FORMAT = dwarf; 420 | ENABLE_STRICT_OBJC_MSGSEND = YES; 421 | ENABLE_TESTABILITY = YES; 422 | GCC_C_LANGUAGE_STANDARD = gnu99; 423 | GCC_DYNAMIC_NO_PIC = NO; 424 | GCC_NO_COMMON_BLOCKS = YES; 425 | GCC_OPTIMIZATION_LEVEL = 0; 426 | GCC_PREPROCESSOR_DEFINITIONS = ( 427 | "DEBUG=1", 428 | "$(inherited)", 429 | ); 430 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 431 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 432 | GCC_WARN_UNDECLARED_SELECTOR = YES; 433 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 434 | GCC_WARN_UNUSED_FUNCTION = YES; 435 | GCC_WARN_UNUSED_VARIABLE = YES; 436 | MACOSX_DEPLOYMENT_TARGET = 10.12; 437 | MTL_ENABLE_DEBUG_INFO = YES; 438 | ONLY_ACTIVE_ARCH = YES; 439 | SDKROOT = macosx; 440 | }; 441 | name = Debug; 442 | }; 443 | 96F33C7B1F62B14A00973AB1 /* Release */ = { 444 | isa = XCBuildConfiguration; 445 | buildSettings = { 446 | ALWAYS_SEARCH_USER_PATHS = NO; 447 | CLANG_ANALYZER_NONNULL = YES; 448 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 449 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 450 | CLANG_CXX_LIBRARY = "libc++"; 451 | CLANG_ENABLE_MODULES = YES; 452 | CLANG_ENABLE_OBJC_ARC = YES; 453 | CLANG_WARN_BOOL_CONVERSION = YES; 454 | CLANG_WARN_CONSTANT_CONVERSION = YES; 455 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 456 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 457 | CLANG_WARN_EMPTY_BODY = YES; 458 | CLANG_WARN_ENUM_CONVERSION = YES; 459 | CLANG_WARN_INFINITE_RECURSION = YES; 460 | CLANG_WARN_INT_CONVERSION = YES; 461 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 462 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 463 | CLANG_WARN_UNREACHABLE_CODE = YES; 464 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 465 | CODE_SIGN_IDENTITY = "-"; 466 | COPY_PHASE_STRIP = NO; 467 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 468 | ENABLE_NS_ASSERTIONS = NO; 469 | ENABLE_STRICT_OBJC_MSGSEND = YES; 470 | GCC_C_LANGUAGE_STANDARD = gnu99; 471 | GCC_NO_COMMON_BLOCKS = YES; 472 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 473 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 474 | GCC_WARN_UNDECLARED_SELECTOR = YES; 475 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 476 | GCC_WARN_UNUSED_FUNCTION = YES; 477 | GCC_WARN_UNUSED_VARIABLE = YES; 478 | MACOSX_DEPLOYMENT_TARGET = 10.12; 479 | MTL_ENABLE_DEBUG_INFO = NO; 480 | SDKROOT = macosx; 481 | }; 482 | name = Release; 483 | }; 484 | 96F33C7D1F62B14A00973AB1 /* Debug */ = { 485 | isa = XCBuildConfiguration; 486 | buildSettings = { 487 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 488 | CODE_SIGN_IDENTITY = "Apple Development"; 489 | COMBINE_HIDPI_IMAGES = YES; 490 | DEVELOPMENT_TEAM = 97KXK82D47; 491 | INFOPLIST_FILE = AutoLazyLoad/Info.plist; 492 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 493 | PRODUCT_BUNDLE_IDENTIFIER = dzw.AutoLazyLoad; 494 | PRODUCT_NAME = "$(TARGET_NAME)"; 495 | PROVISIONING_PROFILE_SPECIFIER = ""; 496 | }; 497 | name = Debug; 498 | }; 499 | 96F33C7E1F62B14A00973AB1 /* Release */ = { 500 | isa = XCBuildConfiguration; 501 | buildSettings = { 502 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 503 | CODE_SIGN_IDENTITY = "Apple Development"; 504 | COMBINE_HIDPI_IMAGES = YES; 505 | DEVELOPMENT_TEAM = 97KXK82D47; 506 | INFOPLIST_FILE = AutoLazyLoad/Info.plist; 507 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 508 | PRODUCT_BUNDLE_IDENTIFIER = dzw.AutoLazyLoad; 509 | PRODUCT_NAME = "$(TARGET_NAME)"; 510 | PROVISIONING_PROFILE_SPECIFIER = ""; 511 | }; 512 | name = Release; 513 | }; 514 | 96F33C951F62B15400973AB1 /* Debug */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | CODE_SIGN_ENTITLEMENTS = LazyLoad/LazyLoad.entitlements; 518 | CODE_SIGN_IDENTITY = "Apple Development"; 519 | COMBINE_HIDPI_IMAGES = YES; 520 | DEVELOPMENT_TEAM = 97KXK82D47; 521 | INFOPLIST_FILE = LazyLoad/Info.plist; 522 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks"; 523 | MACOSX_DEPLOYMENT_TARGET = 10.11; 524 | PRODUCT_BUNDLE_IDENTIFIER = dzw.AutoLazyLoad.LazyLoad; 525 | PRODUCT_NAME = "$(TARGET_NAME)"; 526 | PROVISIONING_PROFILE_SPECIFIER = ""; 527 | SKIP_INSTALL = YES; 528 | }; 529 | name = Debug; 530 | }; 531 | 96F33C961F62B15400973AB1 /* Release */ = { 532 | isa = XCBuildConfiguration; 533 | buildSettings = { 534 | CODE_SIGN_ENTITLEMENTS = LazyLoad/LazyLoad.entitlements; 535 | CODE_SIGN_IDENTITY = "Apple Development"; 536 | COMBINE_HIDPI_IMAGES = YES; 537 | DEVELOPMENT_TEAM = 97KXK82D47; 538 | INFOPLIST_FILE = LazyLoad/Info.plist; 539 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks"; 540 | MACOSX_DEPLOYMENT_TARGET = 10.11; 541 | PRODUCT_BUNDLE_IDENTIFIER = dzw.AutoLazyLoad.LazyLoad; 542 | PRODUCT_NAME = "$(TARGET_NAME)"; 543 | PROVISIONING_PROFILE_SPECIFIER = ""; 544 | SKIP_INSTALL = YES; 545 | }; 546 | name = Release; 547 | }; 548 | /* End XCBuildConfiguration section */ 549 | 550 | /* Begin XCConfigurationList section */ 551 | 96F33C631F62B14A00973AB1 /* Build configuration list for PBXProject "AutoLazyLoad" */ = { 552 | isa = XCConfigurationList; 553 | buildConfigurations = ( 554 | 96F33C7A1F62B14A00973AB1 /* Debug */, 555 | 96F33C7B1F62B14A00973AB1 /* Release */, 556 | ); 557 | defaultConfigurationIsVisible = 0; 558 | defaultConfigurationName = Release; 559 | }; 560 | 96F33C7C1F62B14A00973AB1 /* Build configuration list for PBXNativeTarget "AutoLazyLoad" */ = { 561 | isa = XCConfigurationList; 562 | buildConfigurations = ( 563 | 96F33C7D1F62B14A00973AB1 /* Debug */, 564 | 96F33C7E1F62B14A00973AB1 /* Release */, 565 | ); 566 | defaultConfigurationIsVisible = 0; 567 | defaultConfigurationName = Release; 568 | }; 569 | 96F33C941F62B15400973AB1 /* Build configuration list for PBXNativeTarget "LazyLoad" */ = { 570 | isa = XCConfigurationList; 571 | buildConfigurations = ( 572 | 96F33C951F62B15400973AB1 /* Debug */, 573 | 96F33C961F62B15400973AB1 /* Release */, 574 | ); 575 | defaultConfigurationIsVisible = 0; 576 | defaultConfigurationName = Release; 577 | }; 578 | /* End XCConfigurationList section */ 579 | }; 580 | rootObject = 96F33C601F62B14A00973AB1 /* Project object */; 581 | } 582 | -------------------------------------------------------------------------------- /AutoLazyLoad/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | Default 511 | 512 | 513 | 514 | 515 | 516 | 517 | Left to Right 518 | 519 | 520 | 521 | 522 | 523 | 524 | Right to Left 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | Default 536 | 537 | 538 | 539 | 540 | 541 | 542 | Left to Right 543 | 544 | 545 | 546 | 547 | 548 | 549 | Right to Left 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 支持的扩展: 709 | 1.属性懒加载 710 | 2.快速枚举转Switch 711 | 3.json快速生成属性声明 712 | 713 | 714 | 移除: 715 | 如果不想使用了,在系统的应用程序中删除lazyLoad.app,就可以了. 716 | remove: 717 | If you don't need it anymore, Just remove `AutoLazyLoad.app` from the `../Applications/` folder. 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | --------------------------------------------------------------------------------