├── Pods ├── Headers │ ├── Public │ │ └── XcodeEditor │ │ │ ├── XCGroup.h │ │ │ ├── XCProject.h │ │ │ ├── XCTarget.h │ │ │ ├── XCSourceFile.h │ │ │ ├── XcodeEditor.h │ │ │ ├── XCClassDefinition.h │ │ │ ├── XCKeyBuilder.h │ │ │ ├── XCXibDefinition.h │ │ │ ├── XcodeGroupMember.h │ │ │ ├── XcodeMemberType.h │ │ │ ├── XcodeSourceFileType.h │ │ │ ├── XCAbstractDefinition.h │ │ │ ├── XCFileOperationQueue.h │ │ │ ├── XCFrameworkDefinition.h │ │ │ ├── XCProject+SubProject.h │ │ │ ├── XCProjectBuildConfig.h │ │ │ ├── XCSourceFileDefinition.h │ │ │ └── XCSubProjectDefinition.h │ └── Private │ │ └── XcodeEditor │ │ ├── XCGroup.h │ │ ├── XCProject.h │ │ ├── XCTarget.h │ │ ├── XcodeEditor.h │ │ ├── XCSourceFile.h │ │ ├── XCKeyBuilder.h │ │ ├── XCXibDefinition.h │ │ ├── XcodeGroupMember.h │ │ ├── XcodeMemberType.h │ │ ├── XCClassDefinition.h │ │ ├── XcodeSourceFileType.h │ │ ├── XCAbstractDefinition.h │ │ ├── XCFileOperationQueue.h │ │ ├── XCFrameworkDefinition.h │ │ ├── XCProject+SubProject.h │ │ ├── XCProjectBuildConfig.h │ │ ├── XCSourceFileDefinition.h │ │ └── XCSubProjectDefinition.h ├── Target Support Files │ ├── XcodeEditor │ │ ├── XcodeEditor-prefix.pch │ │ ├── XcodeEditor-dummy.m │ │ └── XcodeEditor.xcconfig │ └── Pods │ │ ├── Pods-dummy.m │ │ ├── Pods.debug.xcconfig │ │ ├── Pods.release.xcconfig │ │ └── Pods-frameworks.sh ├── Manifest.lock ├── XcodeEditor │ └── Source │ │ ├── XcodeGroupMember.h │ │ ├── XCAbstractDefinition.m │ │ ├── Utils │ │ ├── XCKeyBuilder.h │ │ └── XCKeyBuilder.m │ │ ├── XCFrameworkDefinition.h │ │ ├── XCXibDefinition.h │ │ ├── XcodeEditor.h │ │ ├── XCFileOperationQueue.h │ │ ├── XCAbstractDefinition.h │ │ ├── XCProject+SubProject.h │ │ ├── XCProjectBuildConfig.h │ │ ├── XCSourceFileDefinition.h │ │ ├── XcodeMemberType.h │ │ ├── XCClassDefinition.h │ │ ├── XCSubProjectDefinition.h │ │ ├── XCXibDefinition.m │ │ ├── XcodeSourceFileType.h │ │ ├── XCFrameworkDefinition.m │ │ ├── XCTarget.h │ │ ├── XCSourceFile.h │ │ ├── XCSourceFileDefinition.m │ │ ├── XCClassDefinition.m │ │ └── XcodeSourceFileType.m └── Pods.xcodeproj │ └── xcshareddata │ └── xcschemes │ └── Pods.xcscheme ├── fs1.png ├── Podfile ├── FastStub.m ├── Podfile.lock ├── FastStub.h ├── FastStub.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── gaofeng.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcuserdata │ └── gaofeng.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── xcshareddata │ └── xcschemes │ └── FastStub.xcscheme ├── FastStub ├── FSElementProperty.m ├── FSPopTableView │ ├── FSPopTableView.m │ ├── FSTableViewModel.m │ ├── FSPopTableView.h │ ├── FSPopTableViewTable.h │ ├── FSTableViewModel.h │ ├── FSPopTableViewTable.m │ └── FSPopTableViewController.h ├── Processors │ ├── FSCategoryProcessor.h │ ├── FSExtensionProcessor.h │ ├── FSInterfaceProcessor.h │ ├── FSImpProcessor.h │ ├── FSProtocolProcessor.h │ ├── FSExtensionProcessor.m │ ├── FSCategoryProcessor.m │ ├── FSInterfaceProcessor.m │ ├── FSElementProcessor.h │ ├── FSImpProcessor.m │ └── FSProtocolProcessor.m ├── Categories │ ├── XCSourceFile+Path.h │ ├── NSArray+Operations.h │ ├── NSObject+MHLogMethods.h │ ├── NSString+MHNSRange.h │ ├── NSView+Dumping.h │ ├── NSTextView+Operations.h │ ├── NSString+Extensions.h │ ├── NSMutableIndexSet+NSArray.h │ ├── NSArray+Operations.m │ ├── NSMutableIndexSet+NSArray.m │ ├── NSObject+MHLogMethods.m │ ├── XCSourceFile+Path.m │ ├── NSTextView+Operations.m │ ├── NSString+Files.h │ ├── NSFileManager+Headers.h │ ├── NSString+Extensions.m │ ├── NSString+PDRegex │ │ ├── NSString+PDRegex.h │ │ └── NSString+PDRegex.m │ ├── DVTSourceTextStorage+Operations.h │ ├── NSView+Dumping.m │ ├── NSString+MHNSRange.m │ ├── NSString+Files.m │ ├── DVTSourceTextStorage+Operations.m │ └── NSFileManager+Headers.m ├── FSIDENotificationHandler.h ├── NSObject_Extension.h ├── SuggestionController │ ├── FSSuggestionView.m │ ├── FSSuggestionView.h │ ├── FSSuggestionCellModel.m │ ├── FSSuggestionController.h │ └── FSSuggestionCellModel.h ├── FSConst.h ├── SuggestionStubController │ ├── FSSuggestionStubView.h │ ├── FSSuggestionStubView.m │ ├── FSSuggestionStubTableView.h │ ├── FSSuggestionStubTableView.m │ ├── FSSuggestionStubController.h │ └── FSSuggestionStubController.m ├── External │ ├── XcodeEditor │ │ ├── Categories │ │ │ ├── XCProject+Extensions.h │ │ │ ├── XCTarget+XCProject.h │ │ │ ├── XCTarget+XCProject.m │ │ │ ├── NSString+XCAdditions.h │ │ │ ├── XCProject+Extensions.m │ │ │ └── NSString+XCAdditions.m │ │ ├── XCBuildSettings.h │ │ ├── XCWorkspace.h │ │ ├── Source │ │ │ ├── XcodeGroupMember.h │ │ │ ├── XCAbstractDefinition.m │ │ │ ├── Utils │ │ │ │ ├── XCKeyBuilder.h │ │ │ │ └── XCKeyBuilder.m │ │ │ ├── XCFrameworkDefinition.h │ │ │ ├── XCXibDefinition.h │ │ │ ├── XcodeEditor.h │ │ │ ├── XCFileOperationQueue.h │ │ │ ├── XCAbstractDefinition.h │ │ │ ├── XCProject+SubProject.h │ │ │ ├── XCProjectBuildConfig.h │ │ │ ├── XCSourceFileDefinition.h │ │ │ ├── XcodeMemberType.h │ │ │ ├── XCClassDefinition.h │ │ │ ├── XCSubProjectDefinition.h │ │ │ ├── XCXibDefinition.m │ │ │ ├── XcodeSourceFileType.h │ │ │ ├── XCFrameworkDefinition.m │ │ │ ├── XCTarget.h │ │ │ ├── XCSourceFile.h │ │ │ ├── XCSourceFileDefinition.m │ │ │ ├── XCClassDefinition.m │ │ │ └── XcodeSourceFileType.m │ │ ├── XCBuildSettings.m │ │ └── XCWorkspace.m │ └── Benoit │ │ ├── MHXcodeDocumentNavigator.h │ │ └── XCFXcodePrivate.h ├── FastStub-Prefix.pch ├── FastStub.h ├── FastStubInspector.h ├── FSElementCache.m ├── FSElementProperty.h ├── FSElementPool.h ├── NSObject_Extension.m ├── SysHeaders │ ├── FSStub.h │ ├── FSAlertViewDelegate.txt │ ├── FSActionSheetDelegate.txt │ ├── FSTableView.txt │ ├── FSTextView.txt │ └── FSScrollView.txt ├── FSSuggestion.h ├── FSIDESourceEditor.h ├── FSSuggestion.m ├── FSElementCache.h ├── Info.plist ├── FastStub.m ├── FSIDENotificationHandler.m └── FSElementPool.m ├── LICENSE ├── .gitignore └── README.md /Pods/Headers/Public/XcodeEditor/XCGroup.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCGroup.h -------------------------------------------------------------------------------- /fs1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/music4kid/FastStub-Xcode/HEAD/fs1.png -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCGroup.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCGroup.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCProject.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCProject.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCTarget.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCTarget.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XCProject.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCProject.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XCTarget.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCTarget.h -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, "10.9" 2 | 3 | pod 'XcodeEditor' 4 | 5 | link_with ['FastStub'] -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XcodeEditor.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XcodeEditor.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XCSourceFile.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCSourceFile.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XcodeEditor.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XcodeEditor.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCSourceFile.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCSourceFile.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCKeyBuilder.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/Utils/XCKeyBuilder.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCXibDefinition.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCXibDefinition.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XcodeGroupMember.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XcodeGroupMember.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XcodeMemberType.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XcodeMemberType.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XCClassDefinition.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCClassDefinition.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XCKeyBuilder.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/Utils/XCKeyBuilder.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XCXibDefinition.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCXibDefinition.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XcodeGroupMember.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XcodeGroupMember.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XcodeMemberType.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XcodeMemberType.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCClassDefinition.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCClassDefinition.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XcodeSourceFileType.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XcodeSourceFileType.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XcodeSourceFileType.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XcodeSourceFileType.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCAbstractDefinition.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCAbstractDefinition.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCFileOperationQueue.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCFileOperationQueue.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCFrameworkDefinition.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCFrameworkDefinition.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCProject+SubProject.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCProject+SubProject.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCProjectBuildConfig.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCProjectBuildConfig.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XCAbstractDefinition.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCAbstractDefinition.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XCFileOperationQueue.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCFileOperationQueue.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XCFrameworkDefinition.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCFrameworkDefinition.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XCProject+SubProject.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCProject+SubProject.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XCProjectBuildConfig.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCProjectBuildConfig.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XCSourceFileDefinition.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCSourceFileDefinition.h -------------------------------------------------------------------------------- /Pods/Headers/Public/XcodeEditor/XCSubProjectDefinition.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCSubProjectDefinition.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCSourceFileDefinition.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCSourceFileDefinition.h -------------------------------------------------------------------------------- /Pods/Headers/Private/XcodeEditor/XCSubProjectDefinition.h: -------------------------------------------------------------------------------- 1 | ../../../XcodeEditor/Source/XCSubProjectDefinition.h -------------------------------------------------------------------------------- /Pods/Target Support Files/XcodeEditor/XcodeEditor-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods : NSObject 3 | @end 4 | @implementation PodsDummy_Pods 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/XcodeEditor/XcodeEditor-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_XcodeEditor : NSObject 3 | @end 4 | @implementation PodsDummy_XcodeEditor 5 | @end 6 | -------------------------------------------------------------------------------- /FastStub.m: -------------------------------------------------------------------------------- 1 | // 2 | // FastStub.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/25. 6 | // 7 | // 8 | 9 | #import "FastStub.h" 10 | 11 | @implementation FastStub 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - XcodeEditor (1.6.4) 3 | 4 | DEPENDENCIES: 5 | - XcodeEditor 6 | 7 | SPEC CHECKSUMS: 8 | XcodeEditor: c6a79b32b89c86c793d15049a49e96dfd0749351 9 | 10 | COCOAPODS: 0.39.0 11 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - XcodeEditor (1.6.4) 3 | 4 | DEPENDENCIES: 5 | - XcodeEditor 6 | 7 | SPEC CHECKSUMS: 8 | XcodeEditor: c6a79b32b89c86c793d15049a49e96dfd0749351 9 | 10 | COCOAPODS: 0.39.0 11 | -------------------------------------------------------------------------------- /FastStub.h: -------------------------------------------------------------------------------- 1 | // 2 | // FastStub.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/25. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface FastStub : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FastStub.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FastStub.xcodeproj/project.xcworkspace/xcuserdata/gaofeng.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/music4kid/FastStub-Xcode/HEAD/FastStub.xcodeproj/project.xcworkspace/xcuserdata/gaofeng.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /FastStub/FSElementProperty.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // FSElementProperty.m 4 | // FastStub 5 | // 6 | // Created by gao feng on 16/5/27. 7 | // Copyright © 2016年 music4kid. All rights reserved. 8 | // 9 | 10 | #import "FSElementProperty.h" 11 | 12 | @implementation FSElementProperty 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /FastStub/FSPopTableView/FSPopTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSPopTableView.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/27. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSPopTableView.h" 10 | 11 | @implementation FSPopTableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FastStub/FSPopTableView/FSTableViewModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSTableViewModel.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/27. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSTableViewModel.h" 10 | 11 | @implementation FSTableViewModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FastStub/Processors/FSCategoryProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSCategoryProcessor.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/31. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSElementProcessor.h" 10 | 11 | @interface FSCategoryProcessor : FSElementProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/XcodeEditor/XcodeEditor.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/XcodeEditor" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/XcodeEditor" 3 | PODS_ROOT = ${SRCROOT} 4 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /FastStub/Processors/FSExtensionProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSExtensionProcessor.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/18. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSInterfaceProcessor.h" 10 | 11 | @interface FSExtensionProcessor : FSInterfaceProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FastStub/Processors/FSInterfaceProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSInterfaceProcessor.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/20. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSElementProcessor.h" 10 | 11 | @interface FSInterfaceProcessor : FSElementProcessor 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FastStub/Categories/XCSourceFile+Path.h: -------------------------------------------------------------------------------- 1 | // 2 | // XCSourceFile+Path.h 3 | // AutoImporter 4 | // 5 | // Created by Luis Floreani on 9/11/14. 6 | // Copyright (c) 2014 luisfloreani.com. All rights reserved. 7 | // 8 | 9 | #import "XCSourceFile.h" 10 | 11 | @interface XCSourceFile (Path) 12 | 13 | - (NSString *)fullPath; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FastStub/Categories/NSArray+Operations.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+Operations.h 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 06/07/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSArray (Operations) 12 | - (NSArray *)mhFlattenedArray; 13 | @end 14 | -------------------------------------------------------------------------------- /FastStub/Categories/NSObject+MHLogMethods.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MHLogMethods.h 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 08/02/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (MHLogMethods) 12 | - (void)mhLogMethods; 13 | @end 14 | -------------------------------------------------------------------------------- /FastStub/Processors/FSImpProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSImpProcessor.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FSInterfaceProcessor.h" 11 | 12 | @interface FSImpProcessor : FSInterfaceProcessor 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /FastStub/FSIDENotificationHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSIDENotificationHandler.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FSIDENotificationHandler : NSObject 12 | 13 | + (instancetype)sharedInstance; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FastStub/Processors/FSProtocolProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSProtocolProcessor.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FSElementProcessor.h" 11 | 12 | @interface FSProtocolProcessor : FSElementProcessor 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /FastStub/Categories/NSString+MHNSRange.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+MHNSRange.h 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 08/02/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (MHNSRange) 12 | - (NSRange)mhRangeOfLine:(NSInteger) lineNumber; 13 | @end 14 | -------------------------------------------------------------------------------- /FastStub/NSObject_Extension.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject_Extension.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/7. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (Xcode_Plugin_Template_Extension) 12 | 13 | + (void)pluginDidLoad:(NSBundle *)plugin; 14 | 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /FastStub/SuggestionController/FSSuggestionView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSSuggestionView.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/17. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSSuggestionView.h" 10 | 11 | 12 | @interface FSSuggestionView() 13 | 14 | @end 15 | 16 | @implementation FSSuggestionView 17 | 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /FastStub/FSConst.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSConst.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/20. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #ifndef FSConst_h 10 | #define FSConst_h 11 | 12 | #define Notif [NSNotificationCenter defaultCenter] 13 | 14 | #define Notif_SuggestionStubHide @"Notif_SuggestionStubHide" 15 | 16 | #endif /* FSConst_h */ 17 | -------------------------------------------------------------------------------- /FastStub/SuggestionStubController/FSSuggestionStubView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSSuggestionStubView.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/18. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FSSuggestionStubView : NSView 12 | 13 | @property (nonatomic, strong) IBOutlet NSTableView* tableView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/XcodeEditor" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/XcodeEditor" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"XcodeEditor" 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/XcodeEditor" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/XcodeEditor" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"XcodeEditor" 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /FastStub/Categories/NSView+Dumping.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSView+Dumping.h 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 08/02/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //http://www.blackdogfoundry.com/blog/common-xcode4-plugin-techniques/ 12 | @interface NSView (Dumping) 13 | -(void)dumpWithIndent:(NSString *)indent; 14 | @end 15 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Categories/XCProject+Extensions.h: -------------------------------------------------------------------------------- 1 | // 2 | // XCProject+NSDate.h 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 10/06/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import "XCProject.h" 10 | 11 | @interface XCProject (NSDate) 12 | - (NSDate *)dateModified; 13 | @end 14 | 15 | @interface XCProject (MHSubprojects) 16 | - (NSArray *)subProjectFiles; 17 | @end -------------------------------------------------------------------------------- /FastStub/Categories/NSTextView+Operations.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSTextView+Operations.h 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 05/05/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSTextView (Operations) 12 | /** 13 | * Returns frame for caret in text view. 14 | * 15 | * @return a frame 16 | */ 17 | - (NSRect) mhFrameForCaret; 18 | @end 19 | -------------------------------------------------------------------------------- /FastStub/FastStub-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // FastStub-Prefix.pch 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #ifndef FastStub_Prefix_pch 10 | #define FastStub_Prefix_pch 11 | 12 | #ifdef __OBJC__ 13 | #import 14 | #import 15 | #import 16 | #endif 17 | 18 | #endif /* FastStub_Prefix_pch */ 19 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Categories/XCTarget+XCProject.h: -------------------------------------------------------------------------------- 1 | // 2 | // XCTarget+XCProject.h 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 11/05/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import "XCTarget.h" 10 | 11 | @interface XCTarget (XCProject) 12 | @property (nonatomic, strong, readonly) XCProject *project; 13 | @property (nonatomic, strong, readonly) NSArray *frameworks; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FastStub/SuggestionStubController/FSSuggestionStubView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSSuggestionStubView.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/18. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSSuggestionStubView.h" 10 | 11 | @implementation FSSuggestionStubView 12 | 13 | - (void)drawRect:(NSRect)dirtyRect { 14 | [super drawRect:dirtyRect]; 15 | 16 | // Drawing code here. 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /FastStub/FSPopTableView/FSPopTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSPopTableView.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/27. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "FSPopTableViewTable.h" 12 | 13 | @interface FSPopTableView : NSView 14 | 15 | @property (nonatomic, strong) IBOutlet FSPopTableViewTable* tableView; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /FastStub/FastStub.h: -------------------------------------------------------------------------------- 1 | // 2 | // FastStub.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/7. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FastStub; 12 | 13 | static FastStub *sharedPlugin; 14 | 15 | @interface FastStub : NSObject 16 | 17 | + (instancetype)sharedPlugin; 18 | - (id)initWithBundle:(NSBundle *)plugin; 19 | 20 | @property (nonatomic, strong, readonly) NSBundle* bundle; 21 | @end -------------------------------------------------------------------------------- /FastStub/SuggestionController/FSSuggestionView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSSuggestionView.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/17. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FSSuggestionView : NSView 12 | 13 | @property (nonatomic, strong) IBOutlet NSTableView* tableView; 14 | @property (nonatomic, strong) IBOutlet NSTextField* searchField; 15 | 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /FastStub/Categories/NSString+Extensions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Extensions.h 3 | // PropertyParser 4 | // 5 | // Created by marko.hlebar on 7/20/13. 6 | // Copyright (c) 2013 Clover Studio. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (Extensions) 12 | - (BOOL)mh_containsString:(NSString *)string; 13 | - (NSString *)mh_stringByRemovingWhitespacesAndNewlines; 14 | - (BOOL)mh_isAlphaNumeric; 15 | - (BOOL)mh_isWhitespaceOrNewline; 16 | @end 17 | -------------------------------------------------------------------------------- /FastStub/FSPopTableView/FSPopTableViewTable.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSPopTableViewTable.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/27. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol FSPopTableViewTableDelegate 12 | 13 | - (void)onEnterKeyClicked; 14 | 15 | @end 16 | 17 | @interface FSPopTableViewTable : NSTableView 18 | @property (nonatomic, weak) id keyDelegate; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /FastStub/Processors/FSExtensionProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSExtensionProcessor.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/18. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSExtensionProcessor.h" 10 | 11 | @implementation FSExtensionProcessor 12 | 13 | - (NSString *)pattern { 14 | return @"(@interface)\\s+([a-z][a-z0-9_\\s*]+)(.*?)(@end+?)"; 15 | } 16 | 17 | - (FSElementCacheType)getElementType 18 | { 19 | return FSElementCacheExtension; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /FastStub/FastStubInspector.h: -------------------------------------------------------------------------------- 1 | // 2 | // FastStubInspector.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FastStubInspector : NSObject 12 | 13 | + (instancetype)sharedInstance; 14 | 15 | - (void)updateHeader:(NSString *)headerPath; 16 | - (void)updateProject:(NSString *)projectPath completeBlock:(dispatch_block_t)completeBlock; 17 | 18 | - (void)loadCustomElement; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /FastStub/FSElementCache.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSElementCache.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSElementCache.h" 10 | 11 | @implementation FSElementCache 12 | - (instancetype)init 13 | { 14 | self = [super init]; 15 | if (self) { 16 | self.superClasses = [NSMutableSet new]; 17 | self.protocols = [NSMutableSet new]; 18 | self.selectorList = [NSMutableSet new]; 19 | } 20 | return self; 21 | } 22 | @end -------------------------------------------------------------------------------- /FastStub/SuggestionController/FSSuggestionCellModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSSuggestionCellModel.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/17. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSSuggestionCellModel.h" 10 | 11 | @implementation FSSuggestionCellModel 12 | - (instancetype)init 13 | { 14 | self = [super init]; 15 | if (self) { 16 | self.stubs = @[].mutableCopy; 17 | } 18 | return self; 19 | } 20 | @end 21 | 22 | @implementation FSSuggestionStub 23 | 24 | @end -------------------------------------------------------------------------------- /FastStub/Categories/NSMutableIndexSet+NSArray.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableIndexSet+NSArray.h 3 | // MHImportBuster 4 | // 5 | // Created by marko.hlebar on 01/01/14. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSMutableIndexSet (NSArray) 12 | 13 | /** 14 | * Constructs an index set from array of values 15 | * 16 | * @param array an array 17 | * 18 | * @return an index set 19 | */ 20 | +(instancetype) indexSetWithArray:(NSArray*) array; 21 | @end 22 | -------------------------------------------------------------------------------- /FastStub/Processors/FSCategoryProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSCategoryProcessor.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/31. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSCategoryProcessor.h" 10 | 11 | @implementation FSCategoryProcessor 12 | 13 | - (NSString *)pattern { 14 | return @"(@interface)\\s+([a-z][a-z0-9_\\s*\()]+)\\s*\\(\\s*(?:[a-z][a-z0-9_\()]+)\\s*\\)(.*?)(@end+?)"; 15 | } 16 | 17 | - (FSElementCacheType)getElementType 18 | { 19 | return FSElementCacheCategory; 20 | } 21 | 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /FastStub/SuggestionStubController/FSSuggestionStubTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSSuggestionStubTableView.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/20. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol FSSuggestionStubTableViewDelegate 12 | 13 | - (void)onKeyEvent:(NSEvent *)theEvent; 14 | 15 | @end 16 | 17 | @interface FSSuggestionStubTableView : NSTableView 18 | 19 | @property (nonatomic, strong) id suggestionDelegate; 20 | 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /FastStub/Processors/FSInterfaceProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSInterfaceProcessor.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/20. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSInterfaceProcessor.h" 10 | #import "FSElementPool.h" 11 | #import "FSElementCache.h" 12 | 13 | @implementation FSInterfaceProcessor 14 | 15 | 16 | - (NSString *)pattern { 17 | return @"(@interface)\\s+([a-z][a-z0-9_\\s*\()]+)\\s+:?\\s+([a-z][a-z0-9_\()]+)(.*?)(@end+?)"; 18 | } 19 | 20 | - (FSElementCacheType)getElementType 21 | { 22 | return FSElementCacheInterface; 23 | } 24 | 25 | 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /FastStub.xcodeproj/xcuserdata/gaofeng.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | FastStub.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 676E6A8F1CDDB8C8007F65B2 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /FastStub/FSPopTableView/FSTableViewModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSTableViewModel.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/27. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum : NSUInteger { 12 | FSTableViewModelTypePropertyInit, 13 | FSTableViewModelTypeGetterSetter, 14 | } FSTableViewModelType; 15 | 16 | @interface FSTableViewModel : NSObject 17 | 18 | @property (nonatomic, assign) FSTableViewModelType type; 19 | @property (nonatomic, strong) NSString* text; 20 | @property (nonatomic, strong) id customInfo; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /FastStub/FSPopTableView/FSPopTableViewTable.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSPopTableViewTable.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/27. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSPopTableViewTable.h" 10 | 11 | @implementation FSPopTableViewTable 12 | 13 | - (void)keyDown:(NSEvent *)event 14 | { 15 | unichar u = [[event charactersIgnoringModifiers] characterAtIndex:0]; 16 | 17 | if (u == 13 || u == 3) 18 | { 19 | if (_keyDelegate != nil) { 20 | [_keyDelegate onEnterKeyClicked]; 21 | } 22 | } 23 | else 24 | { 25 | [super keyDown:event]; // all other keys 26 | } 27 | } 28 | 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /FastStub/FSElementProperty.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSElementProperty.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/27. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum : NSUInteger { 12 | FSElementPropertyActionInit, 13 | FSElementPropertyActionGetterSetter, 14 | } FSElementPropertyAction; 15 | 16 | @interface FSElementProperty : NSObject 17 | 18 | @property (nonatomic, strong) NSString* propertyName; 19 | @property (nonatomic, strong) NSString* propertyType; 20 | @property (nonatomic, assign) FSElementPropertyAction action; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /FastStub/FSPopTableView/FSPopTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSPopTableViewController.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/27. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @protocol FSPopTableViewControllerDelegate 14 | 15 | - (void)onPopTableViewItemsSelected:(NSArray*)items; 16 | 17 | @end 18 | 19 | @interface FSPopTableViewController : NSViewController 20 | 21 | + (instancetype)showPopWithinView:(NSView*)view withItems:(NSArray*)items; 22 | 23 | @property (nonatomic, weak) id delegate; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /FastStub/SuggestionStubController/FSSuggestionStubTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSSuggestionStubTableView.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/20. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSSuggestionStubTableView.h" 10 | #import "FSConst.h" 11 | 12 | 13 | @implementation FSSuggestionStubTableView 14 | 15 | - (void)keyDown:(NSEvent *)theEvent 16 | { 17 | if (self.suggestionDelegate != nil) { 18 | [self.suggestionDelegate onKeyEvent:theEvent]; 19 | } 20 | 21 | if(theEvent.keyCode == 123) 22 | { 23 | [Notif postNotificationName:Notif_SuggestionStubHide object:nil]; 24 | } 25 | [super keyDown:theEvent]; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /FastStub/External/Benoit/MHXcodeDocumentNavigator.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Benoît on 11/01/14. 3 | // Copyright (c) 2014 Pragmatic Code. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "XCFXcodePrivate.h" 8 | @class IDESourceCodeDocument; 9 | @class XCTarget; 10 | 11 | @interface MHXcodeDocumentNavigator : NSObject 12 | + (id)currentEditor; 13 | + (IDESourceCodeDocument *)currentSourceCodeDocument; 14 | + (NSTextView *)currentSourceCodeTextView; 15 | + (IDEWorkspaceDocument *)currentWorkspaceDocument; 16 | + (NSString *)currentFilePath; 17 | + (NSString *)currentWorkspacePath; 18 | 19 | 20 | + (NSString *)pathForFrameworkNamed:(NSString *)frameworkName; 21 | + (XCTarget *)currentTarget; 22 | @end 23 | -------------------------------------------------------------------------------- /FastStub/FSElementPool.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSElementPool.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/17. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define _Pool [FSElementPool sharedInstance] 12 | 13 | @class FSElementCache; 14 | 15 | @interface FSElementPool : NSObject 16 | 17 | + (instancetype)sharedInstance; 18 | 19 | @property (nonatomic, strong) NSMutableDictionary* elementMap; 20 | 21 | - (void)parseElementFromProjectFile:(NSString*)filePath complete:(dispatch_block_t)completeBlock; 22 | - (void)parseHeaderFile:(NSString*)filePath; 23 | 24 | - (FSElementCache*)getElementFromCache:(NSString*)elementName; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /FastStub/NSObject_Extension.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject_Extension.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/7. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | 10 | #import "NSObject_Extension.h" 11 | #import "FastStub.h" 12 | 13 | @implementation NSObject (Xcode_Plugin_Template_Extension) 14 | 15 | + (void)pluginDidLoad:(NSBundle *)plugin 16 | { 17 | static dispatch_once_t onceToken; 18 | NSString *currentApplicationName = [[NSBundle mainBundle] infoDictionary][@"CFBundleName"]; 19 | if ([currentApplicationName isEqual:@"Xcode"]) { 20 | dispatch_once(&onceToken, ^{ 21 | sharedPlugin = [[FastStub alloc] initWithBundle:plugin]; 22 | }); 23 | } 24 | } 25 | @end 26 | -------------------------------------------------------------------------------- /FastStub/Categories/NSArray+Operations.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+Operations.m 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 06/07/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import "NSArray+Operations.h" 10 | 11 | @implementation NSArray (Operations) 12 | - (NSArray *)mhFlattenedArray { 13 | NSMutableArray *flattenedArray = [NSMutableArray arrayWithCapacity:self.count]; 14 | for (id object in self) { 15 | if ([object isKindOfClass:[NSArray class]]) { 16 | [flattenedArray addObjectsFromArray:[(NSArray*)object mhFlattenedArray]]; 17 | } else { 18 | [flattenedArray addObject:object]; 19 | } 20 | } 21 | return flattenedArray.copy; 22 | } 23 | @end 24 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Categories/XCTarget+XCProject.m: -------------------------------------------------------------------------------- 1 | // 2 | // XCTarget+XCProject.m 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 11/05/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | #import 9 | #import 10 | 11 | static NSString *const XCFrameworkExtension = @".framework"; 12 | 13 | #import "XCTarget+XCProject.h" 14 | 15 | @implementation XCTarget (XCProject) 16 | - (XCProject *)project { 17 | return _project; 18 | } 19 | 20 | - (NSArray *)frameworks { 21 | NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF.name contains[c] %@", XCFrameworkExtension]; 22 | return [self.members filteredArrayUsingPredicate:predicate]; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /FastStub/Categories/NSMutableIndexSet+NSArray.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableIndexSet+NSArray.m 3 | // MHImportBuster 4 | // 5 | // Created by marko.hlebar on 01/01/14. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import "NSMutableIndexSet+NSArray.h" 10 | 11 | @implementation NSMutableIndexSet (NSArray) 12 | /** 13 | * Constructs an index set from array of values 14 | * 15 | * @param array an array 16 | * 17 | * @return an index set 18 | */ 19 | +(instancetype) indexSetWithArray:(NSArray*) array { 20 | NSMutableIndexSet *set = [NSMutableIndexSet indexSet]; 21 | [array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 22 | [set addIndex:[obj integerValue]]; 23 | }]; 24 | return set; 25 | } 26 | @end 27 | -------------------------------------------------------------------------------- /FastStub/SysHeaders/FSStub.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSStub.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/18. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #ifndef FSStub_h 10 | #define FSStub_h 11 | 12 | #define kSingletonImp @"\n\ 13 | + (instancetype)sharedInstance\n\ 14 | {\n\ 15 | static FSPlaceHolder* instance = nil;\n\ 16 | \n\ 17 | static dispatch_once_t onceToken;\n\ 18 | dispatch_once(&onceToken, ^{\n\ 19 | instance = [FSPlaceHolder new];\n\ 20 | });\n\ 21 | \n\ 22 | return instance;\n\ 23 | }\n" 24 | 25 | #define kSingletonHeader @"\n+ (instancetype)sharedInstance;\n" 26 | 27 | #define kExtenionImp @"\ 28 | @interface FSPlaceHolder ()\n\ 29 | \n\ 30 | @end\n\ 31 | \n" 32 | 33 | 34 | #endif /* FSStub_h */ 35 | -------------------------------------------------------------------------------- /FastStub/SuggestionStubController/FSSuggestionStubController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSSuggestionStubController.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/18. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @protocol FSSuggestionStubControllerDelegate 14 | 15 | - (void)onStubItemSelected:(NSArray*)items; 16 | 17 | @end 18 | 19 | @interface FSSuggestionStubController : NSViewController 20 | 21 | + (instancetype)sharedInstance; 22 | 23 | @property (nonatomic, weak) id delegate; 24 | 25 | - (void)configWithContentView:(NSView*)view withItems:(NSArray*)items; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /FastStub/Categories/NSObject+MHLogMethods.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MHLogMethods.m 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 08/02/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import "NSObject+MHLogMethods.h" 10 | #import 11 | 12 | @implementation NSObject (MHLogMethods) 13 | - (void)mhLogMethods { 14 | unsigned int methodCount = 0; 15 | Method *methodList = class_copyMethodList(object_getClass(self), &methodCount); 16 | NSMutableString *methods = [NSMutableString stringWithFormat:@"\n%@\n\n", NSStringFromClass(self.class)]; 17 | for(int i = 0; i < methodCount; i++) { 18 | [methods appendFormat:@"%s\n", sel_getName(method_getName(methodList[i]))]; 19 | } 20 | NSLog(@"%@", methods); 21 | } 22 | @end 23 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/XCBuildSettings.h: -------------------------------------------------------------------------------- 1 | // 2 | // XCBuildSettings.h 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 11/05/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString *const XCBuildSettingsSDKROOTKey; 12 | extern NSString *const XCBuildSettingsHeaderSearchPathsKey; 13 | extern NSString *const XCBuildSettingsUserHeaderSearchPathsKey; 14 | extern NSString *const XCBuildSettingsProjectDirKey; 15 | 16 | @class XCTarget; 17 | @interface XCBuildSettings : NSObject 18 | @property (nonatomic, strong, readonly) XCTarget *target; 19 | @property (nonatomic, readonly) NSDictionary *settings; 20 | + (instancetype)buildSettingsWithTarget:(XCTarget *)target; 21 | - (id) valueForKey:(NSString *)key; 22 | @end 23 | -------------------------------------------------------------------------------- /FastStub/Categories/XCSourceFile+Path.m: -------------------------------------------------------------------------------- 1 | // 2 | // XCSourceFile+Path.m 3 | // AutoImporter 4 | // 5 | // Created by Luis Floreani on 9/11/14. 6 | // Copyright (c) 2014 luisfloreani.com. All rights reserved. 7 | // 8 | 9 | #import "XCSourceFile+Path.h" 10 | #import "XCProject+Extensions.h" 11 | 12 | @interface XCSourceFile() 13 | 14 | @property (nonatomic, readonly) XCProject *project; 15 | 16 | @end 17 | 18 | @implementation XCSourceFile (Path) 19 | 20 | //@dynamic project; 21 | 22 | - (NSString *)fullPath { 23 | XCProject *project = [self valueForKey:@"_project"]; 24 | NSString *projectPath = [project filePath]; 25 | NSString *filePath = [self pathRelativeToProjectRoot]; 26 | return [[projectPath stringByDeletingLastPathComponent] stringByAppendingPathComponent:filePath]; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Categories/NSString+XCAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+XCAdditions.h 3 | // xcode-editor 4 | // 5 | // Created by Marko Hlebar on 08/05/2014. 6 | // Copyright (c) 2014 EXPANZ. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (XCAdditions) 12 | - (NSString *)stringByReplacingOccurrencesOfStrings:(NSArray *)targets 13 | withString:(NSString *)replacement; 14 | 15 | - (BOOL)containsOccurencesOfStrings:(NSArray *)strings; 16 | - (BOOL)mh_containsString:(NSString *)string; 17 | @end 18 | 19 | @interface NSString (ShellExecution) 20 | - (NSString*)xcRunAsCommand; 21 | @end 22 | 23 | @interface NSString (ParseXCSettings) 24 | - (NSDictionary*)xcSettingsDictionary; 25 | - (id)xcParseWhitespaceArray; 26 | @end -------------------------------------------------------------------------------- /FastStub/SysHeaders/FSAlertViewDelegate.txt: -------------------------------------------------------------------------------- 1 | // 2 | // FSActionSheetDelegate.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/17. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | @protocol UIAlertViewDelegate 10 | @optional 11 | 12 | - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex; 13 | 14 | - (void)alertViewCancel:(UIAlertView *)alertView; 15 | 16 | - (void)willPresentAlertView:(UIAlertView *)alertView; 17 | - (void)didPresentAlertView:(UIAlertView *)alertView; 18 | 19 | - (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex; 20 | - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex; 21 | 22 | - (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView; 23 | 24 | @end -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/XCWorkspace.h: -------------------------------------------------------------------------------- 1 | // 2 | // XCWorkspace.h 3 | // xcode-editor 4 | // 5 | // Created by Marko Hlebar on 06/05/2014. 6 | // Copyright (c) 2014 EXPANZ. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString * const XCWorkspaceProjectWorkspaceFile; 12 | 13 | @interface XCWorkspace : NSObject 14 | /** 15 | * Contains an array of XCProject instances 16 | */ 17 | @property (nonatomic, strong, readonly) NSArray *projects; 18 | 19 | /** 20 | * Workspace file path 21 | */ 22 | @property (nonatomic, copy, readonly) NSString *filePath; 23 | 24 | /** 25 | * Instantiates an XCWorkspace with a filePath 26 | * 27 | * @param filePath a filePath 28 | * 29 | * @return a XCWorkspace instance 30 | */ 31 | + (instancetype)workspaceWithFilePath:(NSString*)filePath; 32 | @end 33 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XcodeGroupMember.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import "XcodeMemberType.h" 15 | 16 | @protocol XcodeGroupMember 17 | 18 | - (NSString*)key; 19 | 20 | - (NSString*)displayName; 21 | 22 | - (NSString*)pathRelativeToProjectRoot; 23 | 24 | /** 25 | * Group members can either be other groups (PBXGroup) or source files (PBXFileReference). 26 | */ 27 | - (XcodeMemberType)groupMemberType; 28 | @end -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XcodeGroupMember.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import "XcodeMemberType.h" 15 | 16 | @protocol XcodeGroupMember 17 | 18 | - (NSString*)key; 19 | 20 | - (NSString*)displayName; 21 | 22 | - (NSString*)pathRelativeToProjectRoot; 23 | 24 | /** 25 | * Group members can either be other groups (PBXGroup) or source files (PBXFileReference). 26 | */ 27 | - (XcodeMemberType)groupMemberType; 28 | @end -------------------------------------------------------------------------------- /FastStub/SysHeaders/FSActionSheetDelegate.txt: -------------------------------------------------------------------------------- 1 | // 2 | // FSActionSheetDelegate.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/17. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | @protocol UIActionSheetDelegate 10 | @optional 11 | 12 | // Called when a button is clicked. The view will be automatically dismissed after this call returns 13 | - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex; 14 | - (void)actionSheetCancel:(UIActionSheet *)actionSheet; 15 | 16 | - (void)willPresentActionSheet:(UIActionSheet *)actionSheet; 17 | - (void)didPresentActionSheet:(UIActionSheet *)actionSheet; 18 | 19 | - (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex; 20 | - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex; 21 | 22 | @end -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Categories/XCProject+Extensions.m: -------------------------------------------------------------------------------- 1 | // 2 | // XCProject+NSDate.m 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 10/06/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import "XCProject+Extensions.h" 10 | 11 | @interface XCProject () 12 | - (NSArray*)projectFilesOfType:(XcodeSourceFileType)projectFileType; 13 | @end 14 | 15 | @implementation XCProject (NSDate) 16 | - (NSDate *)dateModified { 17 | NSURL *fileUrl = [NSURL fileURLWithPath:self.filePath]; 18 | NSDate *date = nil; 19 | [fileUrl getResourceValue:&date 20 | forKey:NSURLContentModificationDateKey 21 | error:nil]; 22 | return date; 23 | } 24 | @end 25 | 26 | @implementation XCProject (MHSubprojects) 27 | - (NSArray *)subProjectFiles { 28 | return [self projectFilesOfType:XcodeProject]; 29 | } 30 | @end 31 | -------------------------------------------------------------------------------- /FastStub/Categories/NSTextView+Operations.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSTextView+Operations.m 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 05/05/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import "NSTextView+Operations.h" 10 | 11 | @implementation NSTextView (Operations) 12 | - (NSRect) mhFrameForCaret { 13 | NSArray *selectedRanges = self.selectedRanges; 14 | if (selectedRanges.count > 0) { 15 | NSRange selectedRange = [[self.selectedRanges objectAtIndex:0] rangeValue]; 16 | NSRect keyRectOnScreen = [self firstRectForCharacterRange:selectedRange]; 17 | NSRect keyRectOnWindow = [self.window convertRectFromScreen:keyRectOnScreen]; 18 | NSRect keyRectOnTextView = [self convertRect:keyRectOnWindow fromView:nil]; 19 | keyRectOnTextView.size.width = 1; 20 | return keyRectOnTextView; 21 | } 22 | return NSZeroRect; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /FastStub/SuggestionController/FSSuggestionController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSSuggestionController.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/17. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | typedef enum : NSUInteger { 14 | SuggestionControllerRoot, 15 | SuggestionControllerGeneral, 16 | } SuggestionControllerType; 17 | 18 | @protocol FSSuggestionControllerDelegate 19 | 20 | - (void)onItemSelected:(NSArray*)items; 21 | 22 | @end 23 | 24 | @interface FSSuggestionController : NSViewController 25 | 26 | + (instancetype)sharedInstance; 27 | 28 | @property (nonatomic, weak) id delegate; 29 | @property (nonatomic, assign) SuggestionControllerType ctype; 30 | 31 | 32 | - (void)showSuggestionsInView:(NSView*)view withItems:(NSArray*)items; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /FastStub/Processors/FSElementProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSElementProcessor.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FSElementCache.h" 11 | 12 | typedef void (^processorResultBlock)(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop); 13 | 14 | @interface FSElementProcessor : NSObject 15 | 16 | // must override by subclass 17 | - (NSString *)pattern; 18 | - (FSElementCacheType)getElementType; 19 | 20 | // must override by subclass 21 | - (NSArray *)createElements:(NSString *)content; 22 | 23 | - (NSMutableSet*)buildMethodList:(NSString*)content; 24 | 25 | - (NSMutableSet*)buildSelectorList:(NSString*)content; 26 | 27 | - (void)processContent:(NSString *)content resultBlock:(processorResultBlock)resultBlock; 28 | 29 | - (void)processContent:(NSString *)content withPatternStr:(NSString*)pattern resultBlock:(processorResultBlock)resultBlock; 30 | 31 | @end -------------------------------------------------------------------------------- /FastStub/FSSuggestion.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSSuggestion.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum : NSUInteger { 12 | FSSuggestionSelector, 13 | FSSuggestionProtocol, 14 | FSSuggestionSuperClass, 15 | FSSuggestionHeader, 16 | FSSuggestionGeneral, 17 | FSSuggestionGeneralStub, 18 | } FSSuggestionType; 19 | 20 | typedef enum : NSUInteger { 21 | GeneralStubSingleton = 0, 22 | GeneralStubExtension, 23 | GeneralStubInitWith, 24 | GeneralStubGetterSetter, 25 | GeneralStubCount 26 | } GeneralStubType; 27 | 28 | @interface FSSuggestion : NSObject 29 | 30 | @property (nonatomic, strong) NSString* title; 31 | @property (nonatomic, strong) NSMutableSet* methodList; 32 | @property (nonatomic, assign) FSSuggestionType stype; 33 | 34 | - (NSDictionary*)getGeneralStubs; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /FastStub/FSIDESourceEditor.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSIDESourceEditor.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "FSElementPool.h" 12 | #import "FSElementCache.h" 13 | 14 | @interface FSIDESourceEditor : NSObject 15 | 16 | - (void)showAboveCaret:(NSString *)text color:(NSColor *)color; 17 | 18 | - (FSElementCache*)getCurrentElement; 19 | - (FSElementCache*)getCurrentElementHeader; 20 | 21 | - (void)insertText:(NSString*)text; 22 | - (void)insertText:(NSString*)text withRange:(NSRange)range; 23 | - (void)insertText:(NSString*)text withRange:(NSRange)range withFilePath:(NSString*)filePath; 24 | 25 | - (void)setSelectedRange:(NSRange)range; 26 | - (void)offsetSelectedRange:(int)offset; 27 | - (void)insertMethodImp:(NSString*)method; 28 | - (void)insertNotificationSelectorImp:(NSString*)method; 29 | - (void)saveCodeChanges; 30 | 31 | - (NSView *)view; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /FastStub/Categories/NSString+Files.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Files.h 3 | // MHImportBuster 4 | // 5 | // Created by marko.hlebar on 29/12/13. 6 | // Copyright (c) 2013 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (Files) 12 | /** 13 | * Checks if the file path provided is valid 14 | * 15 | * @return YES if file exists at path 16 | */ 17 | -(BOOL) isValidFilePath; 18 | 19 | /** 20 | * Checks if file path is to a header file 21 | * 22 | * @return YES if file path is to a header file 23 | */ 24 | -(BOOL) isHeaderFilePath; 25 | 26 | /** 27 | * Checks if file path is to an implementation file 28 | * 29 | * @return YES if file path is to an implementation file 30 | */ 31 | -(BOOL) isImplementationFilePath; 32 | 33 | /** 34 | * Adds a suffix to the file path, respecting the file extension. 35 | * 36 | * @param suffix a suffix 37 | * 38 | * @return a file path with added suffix 39 | */ 40 | - (NSString *)filePathByAddingSuffix:(NSString*) suffix; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCAbstractDefinition.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 - 2013 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import "XCAbstractDefinition.h" 14 | 15 | 16 | @implementation XCAbstractDefinition 17 | 18 | @synthesize fileOperationType = _fileOperationType; 19 | 20 | 21 | /* ====================================================================================================================================== */ 22 | #pragma mark - Initialization & Destruction 23 | 24 | - (id)init 25 | { 26 | self = [super init]; 27 | if (self) 28 | { 29 | _fileOperationType = XCFileOperationTypeOverwrite; 30 | } 31 | return self; 32 | } 33 | 34 | 35 | @end -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCAbstractDefinition.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 - 2013 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import "XCAbstractDefinition.h" 14 | 15 | 16 | @implementation XCAbstractDefinition 17 | 18 | @synthesize fileOperationType = _fileOperationType; 19 | 20 | 21 | /* ====================================================================================================================================== */ 22 | #pragma mark - Initialization & Destruction 23 | 24 | - (id)init 25 | { 26 | self = [super init]; 27 | if (self) 28 | { 29 | _fileOperationType = XCFileOperationTypeOverwrite; 30 | } 31 | return self; 32 | } 33 | 34 | 35 | @end -------------------------------------------------------------------------------- /FastStub/FSSuggestion.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSSuggestion.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSSuggestion.h" 10 | #import 11 | #import 12 | 13 | @interface FSSuggestion () 14 | @property (nonatomic, strong) NSDictionary* generalStubMap; 15 | @end 16 | 17 | @implementation FSSuggestion 18 | 19 | - (instancetype)init 20 | { 21 | self = [super init]; 22 | if (self) { 23 | 24 | } 25 | return self; 26 | } 27 | 28 | - (NSDictionary*)getGeneralStubs 29 | { 30 | if (self.generalStubMap == nil) { 31 | self.generalStubMap = @{@(GeneralStubSingleton):@"singleton", 32 | @(GeneralStubExtension):@"interface-extension", 33 | @(GeneralStubInitWith):@"initWith", 34 | @(GeneralStubGetterSetter):@"getter-setter"}; 35 | } 36 | return _generalStubMap; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/Utils/XCKeyBuilder.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 - 2013 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import 14 | 15 | 16 | #define HASH_VALUE_STORAGE_SIZE 48 17 | #define MD5_DIGEST_LENGTH 16 18 | 19 | typedef struct 20 | { 21 | char value[MD5_DIGEST_LENGTH]; 22 | } HashValueMD5Hash; 23 | 24 | 25 | @interface XCKeyBuilder : NSObject 26 | { 27 | unsigned char _value[HASH_VALUE_STORAGE_SIZE]; 28 | } 29 | 30 | + (XCKeyBuilder*)forItemNamed:(NSString*)name; 31 | 32 | + (XCKeyBuilder*)createUnique; 33 | 34 | - (id)initHashValueMD5HashWithBytes:(const void*)bytes length:(NSUInteger)length; 35 | 36 | - (NSString*)build; 37 | 38 | @end 39 | 40 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/Utils/XCKeyBuilder.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 - 2013 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import 14 | 15 | 16 | #define HASH_VALUE_STORAGE_SIZE 48 17 | #define MD5_DIGEST_LENGTH 16 18 | 19 | typedef struct 20 | { 21 | char value[MD5_DIGEST_LENGTH]; 22 | } HashValueMD5Hash; 23 | 24 | 25 | @interface XCKeyBuilder : NSObject 26 | { 27 | unsigned char _value[HASH_VALUE_STORAGE_SIZE]; 28 | } 29 | 30 | + (XCKeyBuilder*)forItemNamed:(NSString*)name; 31 | 32 | + (XCKeyBuilder*)createUnique; 33 | 34 | - (id)initHashValueMD5HashWithBytes:(const void*)bytes length:(NSUInteger)length; 35 | 36 | - (NSString*)build; 37 | 38 | @end 39 | 40 | -------------------------------------------------------------------------------- /FastStub/SuggestionController/FSSuggestionCellModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSSuggestionCellModel.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/17. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum : NSUInteger { 12 | FSSuggestionCellTitleHeader = 0, 13 | FSSuggestionCellTitleSuperClass, 14 | FSSuggestionCellTitleProtocol, 15 | FSSuggestionCellMethod, 16 | FSSuggestionCellSelector, 17 | FSSuggestionCellSelectorHeader, 18 | FSSuggestionCellGeneralStub 19 | } FSSuggestionCellType; 20 | 21 | @interface FSSuggestionCellModel : NSObject 22 | 23 | @property (nonatomic, strong) NSString* cellText; 24 | @property (nonatomic, assign) FSSuggestionCellType cellType; 25 | @property (nonatomic, strong) NSMutableArray* stubs; 26 | 27 | 28 | @end 29 | 30 | 31 | @interface FSSuggestionStub : NSObject 32 | @property (nonatomic, strong) NSNumber* stubKey; 33 | @property (nonatomic, strong) NSString* cellText; 34 | @end -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCFrameworkDefinition.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import 15 | #import "XCAbstractDefinition.h" 16 | 17 | 18 | @interface XCFrameworkDefinition : XCAbstractDefinition 19 | { 20 | NSString* _filePath; 21 | BOOL _copyToDestination; 22 | } 23 | 24 | @property(nonatomic, strong, readonly) NSString* filePath; 25 | @property(nonatomic, readonly) BOOL copyToDestination; 26 | 27 | + (XCFrameworkDefinition*)frameworkDefinitionWithFilePath:(NSString*)filePath copyToDestination:(BOOL)copyToDestination; 28 | 29 | - (id)initWithFilePath:(NSString*)filePath copyToDestination:(BOOL)copyToDestination; 30 | 31 | - (NSString*)fileName; 32 | 33 | 34 | 35 | @end -------------------------------------------------------------------------------- /FastStub/Categories/NSFileManager+Headers.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSFileManager+Headers.h 3 | // PropertyParser 4 | // 5 | // Created by marko.hlebar on 7/20/13. 6 | // Copyright (c) 2013 Clover Studio. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSFileManager (Headers) 12 | ///finds all files with extension in directory and its subdirectories 13 | ///@param extension extension of file ie @"h" 14 | ///@param path directory path 15 | ///@return array of headers 16 | +(NSArray*) findFilesWithExtension:(NSString*) extension inDirectory:(NSString*) path; 17 | 18 | ///finds all files with extensions in directory and its subdirectories 19 | ///@param extensions array of extensions of file ie @[@"h, @"m"] 20 | ///@param path directory path 21 | ///@return array of headers 22 | +(NSArray*) findFilesWithExtensions:(NSArray*) extensions inDirectory:(NSString*) path; 23 | 24 | ///finds all subdirectories inside a directory 25 | ///@param directoryPath directory to find subdirectories for 26 | ///@return subdirectories 27 | +(NSArray*) subDirectoriesInDirectory:(NSString*) directoryPath; 28 | @end 29 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCFrameworkDefinition.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import 15 | #import "XCAbstractDefinition.h" 16 | 17 | 18 | @interface XCFrameworkDefinition : XCAbstractDefinition 19 | { 20 | NSString* _filePath; 21 | BOOL _copyToDestination; 22 | } 23 | 24 | @property(nonatomic, strong, readonly) NSString* filePath; 25 | @property(nonatomic, readonly) BOOL copyToDestination; 26 | 27 | + (XCFrameworkDefinition*)frameworkDefinitionWithFilePath:(NSString*)filePath copyToDestination:(BOOL)copyToDestination; 28 | 29 | - (id)initWithFilePath:(NSString*)filePath copyToDestination:(BOOL)copyToDestination; 30 | 31 | - (NSString*)fileName; 32 | 33 | 34 | 35 | @end -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCXibDefinition.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import 15 | #import "XCAbstractDefinition.h" 16 | 17 | 18 | @interface XCXibDefinition : XCAbstractDefinition 19 | { 20 | NSString* _name; 21 | NSString* _content; 22 | } 23 | @property(nonatomic, strong, readonly) NSString* name; 24 | @property(nonatomic, strong) NSString* content; 25 | 26 | + (XCXibDefinition*)xibDefinitionWithName:(NSString*)name; 27 | 28 | + (XCXibDefinition*)xibDefinitionWithName:(NSString*)name content:(NSString*)content; 29 | 30 | - (id)initWithName:(NSString*)name; 31 | 32 | - (id)initWithName:(NSString*)name content:(NSString*)content; 33 | 34 | - (NSString*)xibFileName; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCXibDefinition.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import 15 | #import "XCAbstractDefinition.h" 16 | 17 | 18 | @interface XCXibDefinition : XCAbstractDefinition 19 | { 20 | NSString* _name; 21 | NSString* _content; 22 | } 23 | @property(nonatomic, strong, readonly) NSString* name; 24 | @property(nonatomic, strong) NSString* content; 25 | 26 | + (XCXibDefinition*)xibDefinitionWithName:(NSString*)name; 27 | 28 | + (XCXibDefinition*)xibDefinitionWithName:(NSString*)name content:(NSString*)content; 29 | 30 | - (id)initWithName:(NSString*)name; 31 | 32 | - (id)initWithName:(NSString*)name content:(NSString*)content; 33 | 34 | - (NSString*)xibFileName; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 gao feng 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /FastStub/Categories/NSString+Extensions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Extensions.m 3 | // PropertyParser 4 | // 5 | // Created by marko.hlebar on 7/20/13. 6 | // Copyright (c) 2013 Clover Studio. All rights reserved. 7 | // 8 | 9 | #import "NSString+Extensions.h" 10 | 11 | @implementation NSString (Extensions) 12 | - (BOOL)mh_containsString:(NSString *)string { 13 | return [self rangeOfString:string].location != NSNotFound; 14 | } 15 | 16 | - (NSString *)mh_stringByRemovingWhitespacesAndNewlines { 17 | NSString *string = [self stringByReplacingOccurrencesOfString:@" " withString:@""]; 18 | return [string stringByReplacingOccurrencesOfString:@"\n" withString:@""]; 19 | } 20 | 21 | - (BOOL)mh_isAlphaNumeric { 22 | NSCharacterSet *unwantedCharacters = [[NSCharacterSet alphanumericCharacterSet] invertedSet]; 23 | return [self rangeOfCharacterFromSet:unwantedCharacters].location == NSNotFound; 24 | } 25 | 26 | - (BOOL)mh_isWhitespaceOrNewline { 27 | NSString *string = [self stringByReplacingOccurrencesOfString:@" " withString:@""]; 28 | string = [self stringByReplacingOccurrencesOfString:@"\n" withString:@""]; 29 | return string.length == 0; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /FastStub/Categories/NSString+PDRegex/NSString+PDRegex.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+PDRegex.h 3 | // RegexOnNSString 4 | // 5 | // Created by Carl Brown on 10/3/11. 6 | // Copyright 2011 PDAgent, LLC. Released under MIT License. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (PDRegex) 12 | 13 | -(NSString *) vv_stringByReplacingRegexPattern:(NSString *)regex withString:(NSString *) replacement; 14 | -(NSString *) vv_stringByReplacingRegexPattern:(NSString *)regex withString:(NSString *) replacement caseInsensitive:(BOOL) ignoreCase; 15 | -(NSString *) vv_stringByReplacingRegexPattern:(NSString *)regex withString:(NSString *) replacement caseInsensitive:(BOOL) ignoreCase treatAsOneLine:(BOOL) assumeMultiLine; 16 | -(NSArray *) vv_stringsByExtractingGroupsUsingRegexPattern:(NSString *)regex; 17 | -(NSArray *) vv_stringsByExtractingGroupsUsingRegexPattern:(NSString *)regex caseInsensitive:(BOOL) ignoreCase treatAsOneLine:(BOOL) assumeMultiLine; 18 | -(BOOL) vv_matchesPatternRegexPattern:(NSString *)regex; 19 | -(BOOL) vv_matchesPatternRegexPattern:(NSString *)regex caseInsensitive:(BOOL) ignoreCase treatAsOneLine:(BOOL) assumeMultiLine; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /FastStub/Categories/DVTSourceTextStorage+Operations.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVTSourceTextStorage+Operations.h 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 08/02/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * A category on NSTextStorage, which mimicks a category on DVTSourceTextStorage 13 | */ 14 | @interface NSTextStorage (MHOperations) 15 | 16 | /** 17 | * Inserts a string at a certain line number in the string. 18 | * 19 | * @param string a string to insert. 20 | * @param lineNumber a line number where to insert the string. Line numbers are enumerated starting from 0. 21 | */ 22 | - (void)mhInsertString:(NSString *)string atLine:(NSUInteger)lineNumber; 23 | 24 | /** 25 | * Deletes a string at a certain line number in the string 26 | * 27 | * @param lineNumber a line number where to delete the string. Line numbers are enumerated starting from 0. 28 | */ 29 | - (void)mhDeleteLine:(NSInteger)lineNumber; 30 | 31 | /** 32 | * Batch deletes lines at given line numbers. 33 | * 34 | * @param lineNumbers line numbers to delete 35 | */ 36 | - (void)mhDeleteLines:(NSIndexSet *)lineNumbers; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /FastStub/Processors/FSImpProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSImpProcessor.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSImpProcessor.h" 10 | #import "FSElementCache.h" 11 | #import "NSString+PDRegex.h" 12 | 13 | @implementation FSImpProcessor 14 | 15 | - (NSString *)pattern { 16 | return @"(@implementation)\\s+([a-z][a-z0-9_\()]+)(.*?)(@end+?)"; 17 | } 18 | 19 | - (FSElementCacheType)getElementType 20 | { 21 | return FSElementCacheImp; 22 | } 23 | 24 | - (NSMutableSet*)buildSelectorList:(NSString*)content 25 | { 26 | NSMutableSet* selectors = [NSMutableSet new]; 27 | 28 | 29 | //parse based on file type, better accuracy 30 | NSArray* matchedMethods = nil; 31 | 32 | //only support notification selector 33 | NSString* regex = regex = @"selector:@selector\\((.*?)\\)"; 34 | 35 | matchedMethods = [content vv_stringsByExtractingGroupsUsingRegexPattern:regex caseInsensitive:false treatAsOneLine:true]; 36 | for (int i = 0; i < matchedMethods.count; i++) { 37 | NSString* selector = [NSString stringWithFormat:@"%@", matchedMethods[i]]; 38 | [selectors addObject:selector]; 39 | } 40 | 41 | return selectors; 42 | } 43 | 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XcodeEditor.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | #import 13 | 14 | //! Project version number for XcodeEditor. 15 | FOUNDATION_EXPORT double XcodeEditorVersionNumber; 16 | 17 | //! Project version string for XcodeEditor. 18 | FOUNDATION_EXPORT const unsigned char XcodeEditorVersionString[]; 19 | 20 | // In this header, you should import all the public headers of your framework using statements like #import 21 | 22 | 23 | #import "XCAbstractDefinition.h" 24 | #import "XCGroup.h" 25 | #import "XCClassDefinition.h" 26 | #import "XCFileOperationQueue.h" 27 | #import "XCFrameworkDefinition.h" 28 | #import "XCProject.h" 29 | #import "XCSourceFile.h" 30 | #import "XCSourceFileDefinition.h" 31 | #import "XCSubProjectDefinition.h" 32 | #import "XCTarget.h" 33 | #import "XCXibDefinition.h" 34 | #import "XCKeyBuilder.h" 35 | #import "XCProject+SubProject.h" 36 | #import "XCProjectBuildConfig.h" 37 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XcodeEditor.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | #import 13 | 14 | //! Project version number for XcodeEditor. 15 | FOUNDATION_EXPORT double XcodeEditorVersionNumber; 16 | 17 | //! Project version string for XcodeEditor. 18 | FOUNDATION_EXPORT const unsigned char XcodeEditorVersionString[]; 19 | 20 | // In this header, you should import all the public headers of your framework using statements like #import 21 | 22 | 23 | #import "XCAbstractDefinition.h" 24 | #import "XCGroup.h" 25 | #import "XCClassDefinition.h" 26 | #import "XCFileOperationQueue.h" 27 | #import "XCFrameworkDefinition.h" 28 | #import "XCProject.h" 29 | #import "XCSourceFile.h" 30 | #import "XCSourceFileDefinition.h" 31 | #import "XCSubProjectDefinition.h" 32 | #import "XCTarget.h" 33 | #import "XCXibDefinition.h" 34 | #import "XCKeyBuilder.h" 35 | #import "XCProject+SubProject.h" 36 | #import "XCProjectBuildConfig.h" 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /FastStub/FSElementCache.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSElementCache.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum : NSUInteger { 12 | FSElementCacheInterface, 13 | FSElementCacheProtocol, 14 | FSElementCacheImp, 15 | FSElementCacheExtension, 16 | FSElementCacheCategory, 17 | } FSElementCacheType; 18 | 19 | @interface FSElementCache : NSObject 20 | @property (nonatomic, strong) NSString* filePath; 21 | @property (nonatomic, strong) NSString* elementName; 22 | @property (nonatomic, strong) NSMutableSet* methodList; 23 | @property (nonatomic, strong) NSMutableSet* propertyList; 24 | @property (nonatomic, strong) NSMutableSet* selectorList; 25 | 26 | @property (nonatomic, assign) FSElementCacheType elementType; 27 | @property (nonatomic, assign) NSRange contentRange; 28 | @property (nonatomic, assign) NSRange contentBeginRange; 29 | @property (nonatomic, assign) NSRange elementBeginRange; 30 | 31 | @property (nonatomic, strong) NSMutableSet* superClasses; 32 | @property (nonatomic, strong) NSMutableSet* protocols; 33 | 34 | @end -------------------------------------------------------------------------------- /FastStub/Categories/NSView+Dumping.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSView+Dumping.m 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 08/02/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import "NSView+Dumping.h" 10 | 11 | @implementation NSView (Dumping) 12 | 13 | -(void)dumpWithIndent:(NSString *)indent { 14 | NSString *clazz = NSStringFromClass([self class]); 15 | NSString *info = @""; 16 | if ([self respondsToSelector:@selector(title)]) { 17 | NSString *title = [self performSelector:@selector(title)]; 18 | if (title != nil && [title length] > 0) 19 | info = [info stringByAppendingFormat:@" title=%@", title]; 20 | } 21 | if ([self respondsToSelector:@selector(stringValue)]) { 22 | NSString *string = [self performSelector:@selector(stringValue)]; 23 | if (string != nil && [string length] > 0) 24 | info = [info stringByAppendingFormat:@" stringValue=%@", string]; 25 | } 26 | NSString *tooltip = [self toolTip]; 27 | if (tooltip != nil && [tooltip length] > 0) 28 | info = [info stringByAppendingFormat:@" tooltip=%@", tooltip]; 29 | 30 | NSLog(@"%@%@%@", indent, clazz, info); 31 | 32 | if ([[self subviews] count] > 0) { 33 | NSString *subIndent = [NSString stringWithFormat:@"%@%@", indent, ([indent length]/2)%2==0 ? @"| " : @": "]; 34 | for (NSView *subview in [self subviews]) 35 | [subview dumpWithIndent:subIndent]; 36 | } 37 | } 38 | 39 | @end -------------------------------------------------------------------------------- /FastStub/Categories/NSString+MHNSRange.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+MHNSRange.m 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 08/02/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import "NSString+MHNSRange.h" 10 | 11 | @implementation NSString (MHNSRange) 12 | - (NSRange)mhRangeOfLine:(NSInteger) lineNumber { 13 | //special case when length of the string is 0 14 | if (lineNumber == 0 && self.length == 0) { 15 | return NSMakeRange(0, 0); 16 | } 17 | __block NSInteger currentLineNumber = 0; 18 | __block BOOL foundLine = NO; 19 | __block NSRange range = NSMakeRange(0, 0); 20 | [self enumerateLinesUsingBlock:^(NSString *line, BOOL *stop) { 21 | if (lineNumber == currentLineNumber) { 22 | range.length = (line.length + 1); 23 | foundLine = YES; 24 | *stop = YES; 25 | } 26 | else { 27 | range.location += (line.length + 1); //+1 for \n 28 | } 29 | currentLineNumber++; 30 | }]; 31 | 32 | if (foundLine) { 33 | //trim the length 34 | NSInteger lengthDiff = self.length - (range.location + range.length); 35 | if (lengthDiff < 0) { 36 | range.length += lengthDiff; 37 | } 38 | } 39 | else { 40 | range.location = NSNotFound; 41 | range.length = 0; 42 | } 43 | 44 | return range; 45 | } 46 | @end 47 | -------------------------------------------------------------------------------- /FastStub/SysHeaders/FSTableView.txt: -------------------------------------------------------------------------------- 1 | // 2 | // FSTableView.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/17. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | @protocol UITableViewDelegate 10 | 11 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; 12 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section; 13 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section; 14 | 15 | - (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section; 16 | - (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section; 17 | 18 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath; 19 | 20 | @end 21 | 22 | 23 | @protocol UITableViewDataSource 24 | 25 | @required 26 | 27 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; 28 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; 29 | 30 | @optional 31 | 32 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView; 33 | - (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section; 34 | - (nullable NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section; 35 | 36 | @end 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCFileOperationQueue.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import 14 | 15 | 16 | @interface XCFileOperationQueue : NSObject 17 | { 18 | 19 | @private 20 | NSString* _baseDirectory; 21 | NSMutableDictionary* _filesToWrite; 22 | NSMutableDictionary* _frameworksToCopy; 23 | NSMutableArray* _filesToDelete; 24 | NSMutableArray* _directoriesToCreate; 25 | } 26 | 27 | 28 | - (id)initWithBaseDirectory:(NSString*)baseDirectory; 29 | 30 | - (BOOL)fileWithName:(NSString*)name existsInProjectDirectory:(NSString*)directory; 31 | 32 | - (void)queueTextFile:(NSString*)fileName inDirectory:(NSString*)directory withContents:(NSString*)contents; 33 | 34 | - (void)queueDataFile:(NSString*)fileName inDirectory:(NSString*)directory withContents:(NSData*)contents; 35 | 36 | - (void)queueFrameworkWithFilePath:(NSString*)filePath inDirectory:(NSString*)directory; 37 | 38 | - (void)queueDeletion:(NSString*)filePath; 39 | 40 | - (void)queueDirectory:(NSString*)withName inDirectory:(NSString*)parentDirectory; 41 | 42 | - (void)commitFileOperations; 43 | 44 | @end 45 | 46 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCFileOperationQueue.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import 14 | 15 | 16 | @interface XCFileOperationQueue : NSObject 17 | { 18 | 19 | @private 20 | NSString* _baseDirectory; 21 | NSMutableDictionary* _filesToWrite; 22 | NSMutableDictionary* _frameworksToCopy; 23 | NSMutableArray* _filesToDelete; 24 | NSMutableArray* _directoriesToCreate; 25 | } 26 | 27 | 28 | - (id)initWithBaseDirectory:(NSString*)baseDirectory; 29 | 30 | - (BOOL)fileWithName:(NSString*)name existsInProjectDirectory:(NSString*)directory; 31 | 32 | - (void)queueTextFile:(NSString*)fileName inDirectory:(NSString*)directory withContents:(NSString*)contents; 33 | 34 | - (void)queueDataFile:(NSString*)fileName inDirectory:(NSString*)directory withContents:(NSData*)contents; 35 | 36 | - (void)queueFrameworkWithFilePath:(NSString*)filePath inDirectory:(NSString*)directory; 37 | 38 | - (void)queueDeletion:(NSString*)filePath; 39 | 40 | - (void)queueDirectory:(NSString*)withName inDirectory:(NSString*)parentDirectory; 41 | 42 | - (void)commitFileOperations; 43 | 44 | @end 45 | 46 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCAbstractDefinition.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 - 2013 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import 14 | 15 | typedef enum 16 | { 17 | 18 | /** 19 | * Creates the reference in the project and writes the contents to disk. If a file already exists at the specified 20 | * location, its contents will be updated. 21 | */ 22 | XCFileOperationTypeOverwrite, 23 | 24 | /** 25 | * Creates the reference in the project. If a file already exists at the specified location, the contents will not 26 | * be updated. 27 | */ 28 | XCFileOperationTypeAcceptExisting, 29 | 30 | /** 31 | * Creates the reference in the project, but does not write to disk. The filesystem is expected to be updated 32 | * through some other means. 33 | */ 34 | XCFileOperationTypeReferenceOnly 35 | } XCFileOperationType; 36 | 37 | /** 38 | * Holds properties to all types of resource that can be added to an Xcode project. 39 | */ 40 | @interface XCAbstractDefinition : NSObject 41 | { 42 | XCFileOperationType _fileOperationType; 43 | } 44 | 45 | @property(nonatomic) XCFileOperationType fileOperationType; 46 | 47 | 48 | @end -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCProject+SubProject.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import 15 | #import "XCProject.h" 16 | 17 | @interface XCProject (SubProject) 18 | 19 | 20 | - (NSString *)referenceProxyKeyForName:(NSString *)name; 21 | 22 | - (NSArray *)buildProductsForTargets:(NSString *)xcodeprojKey; 23 | 24 | - (void)addAsTargetDependency:(XCSubProjectDefinition *)xcodeprojDefinition toTargets:(NSArray*)targets; 25 | 26 | - (NSArray *)keysForProjectObjectsOfType:(XcodeMemberType)memberType withIdentifier:(NSString *)identifier 27 | singleton:(BOOL)singleton required:(BOOL)required; 28 | 29 | - (NSMutableDictionary *)PBXProjectDict; 30 | 31 | - (void)removeProxies:(NSString *)xcodeprojKey; 32 | 33 | - (void)addProxies:(XCSubProjectDefinition *)xcodeproj; 34 | 35 | - (void)removeFromProjectReferences:(NSString *)key forProductsGroup:(NSString *)productsGroupKey; 36 | 37 | - (void)removeTargetDependencies:(NSString *)name; 38 | 39 | - (NSString *)containerItemProxyKeyForName:(NSString *)name proxyType:(NSString *)proxyType; 40 | 41 | - (NSString *)productsGroupKeyForKey:(NSString *)key; 42 | 43 | @end -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCProjectBuildConfig.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | #import 13 | 14 | @class XCProject; 15 | 16 | @interface XCProjectBuildConfig : NSObject 17 | { 18 | @private 19 | __weak XCProject* _project; 20 | NSString* _key; 21 | 22 | NSMutableDictionary* _buildSettings; 23 | NSMutableDictionary* _xcconfigSettings; 24 | } 25 | @property(nonatomic, strong, readonly) NSString* key; 26 | @property(nonatomic, readonly) NSDictionary* specifiedBuildSettings; 27 | 28 | + (NSDictionary*)buildConfigurationsFromArray:(NSArray*)array inProject:(XCProject*)project; 29 | 30 | - (instancetype)initWithProject:(XCProject*)project key:(NSString*)key; 31 | 32 | - (void)addBuildSettings:(NSDictionary*)buildSettings; 33 | 34 | - (void)addOrReplaceSetting:(id )setting forKey:(NSString*)key; 35 | 36 | - (id )valueForKey:(NSString*)key; 37 | 38 | + (NSString*)duplicatedBuildConfigurationListWithKey:(NSString*)buildConfigurationListKey inProject:(XCProject*)project 39 | withBuildConfigurationVisitor:(void (^)(NSMutableDictionary*))buildConfigurationVisitor; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCAbstractDefinition.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 - 2013 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import 14 | 15 | typedef enum 16 | { 17 | 18 | /** 19 | * Creates the reference in the project and writes the contents to disk. If a file already exists at the specified 20 | * location, its contents will be updated. 21 | */ 22 | XCFileOperationTypeOverwrite, 23 | 24 | /** 25 | * Creates the reference in the project. If a file already exists at the specified location, the contents will not 26 | * be updated. 27 | */ 28 | XCFileOperationTypeAcceptExisting, 29 | 30 | /** 31 | * Creates the reference in the project, but does not write to disk. The filesystem is expected to be updated 32 | * through some other means. 33 | */ 34 | XCFileOperationTypeReferenceOnly 35 | } XCFileOperationType; 36 | 37 | /** 38 | * Holds properties to all types of resource that can be added to an Xcode project. 39 | */ 40 | @interface XCAbstractDefinition : NSObject 41 | { 42 | XCFileOperationType _fileOperationType; 43 | } 44 | 45 | @property(nonatomic) XCFileOperationType fileOperationType; 46 | 47 | 48 | @end -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCProject+SubProject.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import 15 | #import "XCProject.h" 16 | 17 | @interface XCProject (SubProject) 18 | 19 | 20 | - (NSString *)referenceProxyKeyForName:(NSString *)name; 21 | 22 | - (NSArray *)buildProductsForTargets:(NSString *)xcodeprojKey; 23 | 24 | - (void)addAsTargetDependency:(XCSubProjectDefinition *)xcodeprojDefinition toTargets:(NSArray*)targets; 25 | 26 | - (NSArray *)keysForProjectObjectsOfType:(XcodeMemberType)memberType withIdentifier:(NSString *)identifier 27 | singleton:(BOOL)singleton required:(BOOL)required; 28 | 29 | - (NSMutableDictionary *)PBXProjectDict; 30 | 31 | - (void)removeProxies:(NSString *)xcodeprojKey; 32 | 33 | - (void)addProxies:(XCSubProjectDefinition *)xcodeproj; 34 | 35 | - (void)removeFromProjectReferences:(NSString *)key forProductsGroup:(NSString *)productsGroupKey; 36 | 37 | - (void)removeTargetDependencies:(NSString *)name; 38 | 39 | - (NSString *)containerItemProxyKeyForName:(NSString *)name proxyType:(NSString *)proxyType; 40 | 41 | - (NSString *)productsGroupKeyForKey:(NSString *)key; 42 | 43 | @end -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCProjectBuildConfig.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | #import 13 | 14 | @class XCProject; 15 | 16 | @interface XCProjectBuildConfig : NSObject 17 | { 18 | @private 19 | __weak XCProject* _project; 20 | NSString* _key; 21 | 22 | NSMutableDictionary* _buildSettings; 23 | NSMutableDictionary* _xcconfigSettings; 24 | } 25 | @property(nonatomic, strong, readonly) NSString* key; 26 | @property(nonatomic, readonly) NSDictionary* specifiedBuildSettings; 27 | 28 | + (NSDictionary*)buildConfigurationsFromArray:(NSArray*)array inProject:(XCProject*)project; 29 | 30 | - (instancetype)initWithProject:(XCProject*)project key:(NSString*)key; 31 | 32 | - (void)addBuildSettings:(NSDictionary*)buildSettings; 33 | 34 | - (void)addOrReplaceSetting:(id )setting forKey:(NSString*)key; 35 | 36 | - (id )valueForKey:(NSString*)key; 37 | 38 | + (NSString*)duplicatedBuildConfigurationListWithKey:(NSString*)buildConfigurationListKey inProject:(XCProject*)project 39 | withBuildConfigurationVisitor:(void (^)(NSMutableDictionary*))buildConfigurationVisitor; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCSourceFileDefinition.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import 15 | #import "XCAbstractDefinition.h" 16 | #import "XcodeSourceFileType.h" 17 | 18 | @interface XCSourceFileDefinition : XCAbstractDefinition 19 | { 20 | 21 | NSString* _sourceFileName; 22 | XcodeSourceFileType _type; 23 | NSData* _data; 24 | 25 | } 26 | 27 | @property(nonatomic, strong, readonly) NSString* sourceFileName; 28 | @property(nonatomic, strong, readonly) NSData* data; 29 | @property(nonatomic, readonly) XcodeSourceFileType type; 30 | 31 | + (XCSourceFileDefinition*)sourceDefinitionWithName:(NSString*)name text:(NSString*)text type:(XcodeSourceFileType)type; 32 | 33 | + (XCSourceFileDefinition*)sourceDefinitionWithName:(NSString*)name data:(NSData*)data type:(XcodeSourceFileType)type; 34 | 35 | // For now you can add Asset Catalog only as reference 36 | + (XCSourceFileDefinition*)sourceDefinitionWithAssetCatalogName:(NSString*)name; 37 | 38 | - (id)initWithName:(NSString*)name text:(NSString*)text type:(XcodeSourceFileType)type; 39 | 40 | - (id)initWithName:(NSString*)name data:(NSData*)data type:(XcodeSourceFileType)type; 41 | 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCSourceFileDefinition.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import 15 | #import "XCAbstractDefinition.h" 16 | #import "XcodeSourceFileType.h" 17 | 18 | @interface XCSourceFileDefinition : XCAbstractDefinition 19 | { 20 | 21 | NSString* _sourceFileName; 22 | XcodeSourceFileType _type; 23 | NSData* _data; 24 | 25 | } 26 | 27 | @property(nonatomic, strong, readonly) NSString* sourceFileName; 28 | @property(nonatomic, strong, readonly) NSData* data; 29 | @property(nonatomic, readonly) XcodeSourceFileType type; 30 | 31 | + (XCSourceFileDefinition*)sourceDefinitionWithName:(NSString*)name text:(NSString*)text type:(XcodeSourceFileType)type; 32 | 33 | + (XCSourceFileDefinition*)sourceDefinitionWithName:(NSString*)name data:(NSData*)data type:(XcodeSourceFileType)type; 34 | 35 | // For now you can add Asset Catalog only as reference 36 | + (XCSourceFileDefinition*)sourceDefinitionWithAssetCatalogName:(NSString*)name; 37 | 38 | - (id)initWithName:(NSString*)name text:(NSString*)text type:(XcodeSourceFileType)type; 39 | 40 | - (id)initWithName:(NSString*)name data:(NSData*)data type:(XcodeSourceFileType)type; 41 | 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XcodeMemberType.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | #import 13 | 14 | typedef enum 15 | { 16 | PBXNilType, 17 | PBXBuildFileType, 18 | PBXContainerItemProxyType, 19 | PBXCopyFilesBuildPhaseType, 20 | PBXFileReferenceType, 21 | PBXFrameworksBuildPhaseType, 22 | PBXGroupType, 23 | PBXNativeTargetType, 24 | PBXProjectType, 25 | PBXReferenceProxyType, 26 | PBXResourcesBuildPhaseType, 27 | PBXSourcesBuildPhaseType, 28 | PBXTargetDependencyType, 29 | PBXVariantGroupType, 30 | XCBuildConfigurationType, 31 | XCConfigurationListType 32 | } XcodeMemberType; 33 | 34 | @interface NSString (XcodeMemberTypeExtensions) 35 | 36 | + (NSString*)xce_stringFromMemberType:(XcodeMemberType)nodeType; 37 | 38 | - (XcodeMemberType)xce_asMemberType; 39 | 40 | - (BOOL)xce_hasFileReferenceType; 41 | - (BOOL)xce_hasFileReferenceOrReferenceProxyType; 42 | - (BOOL)xce_hasReferenceProxyType; 43 | - (BOOL)xce_hasGroupType; 44 | - (BOOL)xce_hasProjectType; 45 | - (BOOL)xce_hasNativeTargetType; 46 | - (BOOL)xce_hasBuildFileType; 47 | - (BOOL)xce_hasBuildConfigurationType; 48 | - (BOOL)xce_hasContainerItemProxyType; 49 | - (BOOL)xce_hasResourcesBuildPhaseType; 50 | - (BOOL)xce_hasSourcesOrFrameworksBuildPhaseType; 51 | 52 | @end 53 | 54 | 55 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XcodeMemberType.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | #import 13 | 14 | typedef enum 15 | { 16 | PBXNilType, 17 | PBXBuildFileType, 18 | PBXContainerItemProxyType, 19 | PBXCopyFilesBuildPhaseType, 20 | PBXFileReferenceType, 21 | PBXFrameworksBuildPhaseType, 22 | PBXGroupType, 23 | PBXNativeTargetType, 24 | PBXProjectType, 25 | PBXReferenceProxyType, 26 | PBXResourcesBuildPhaseType, 27 | PBXSourcesBuildPhaseType, 28 | PBXTargetDependencyType, 29 | PBXVariantGroupType, 30 | XCBuildConfigurationType, 31 | XCConfigurationListType 32 | } XcodeMemberType; 33 | 34 | @interface NSString (XcodeMemberTypeExtensions) 35 | 36 | + (NSString*)xce_stringFromMemberType:(XcodeMemberType)nodeType; 37 | 38 | - (XcodeMemberType)xce_asMemberType; 39 | 40 | - (BOOL)xce_hasFileReferenceType; 41 | - (BOOL)xce_hasFileReferenceOrReferenceProxyType; 42 | - (BOOL)xce_hasReferenceProxyType; 43 | - (BOOL)xce_hasGroupType; 44 | - (BOOL)xce_hasProjectType; 45 | - (BOOL)xce_hasNativeTargetType; 46 | - (BOOL)xce_hasBuildFileType; 47 | - (BOOL)xce_hasBuildConfigurationType; 48 | - (BOOL)xce_hasContainerItemProxyType; 49 | - (BOOL)xce_hasResourcesBuildPhaseType; 50 | - (BOOL)xce_hasSourcesOrFrameworksBuildPhaseType; 51 | 52 | @end 53 | 54 | 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FastStub-Xcode 2 | 3 | > Life is short, why waste it on meaningless typing? 4 | 5 | ### What is it? 6 | **A code generating feature borrowed from Android Studio.** 7 | 8 | FastStub automatically finds out missing method implementaions from .h file, super class, and all procotols your class uses, also provides you a fast way to insert them. 9 | 10 | 11 | 12 | common protocols like UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate are supported. What's your favourite way to put on some tableview's boilerplate code? anything like this? 13 | 14 | 15 | 16 | ### Superduper way to write singleton 17 | 18 | 19 | 20 | ### Embrace model with initWith: 21 | 22 | 23 | 24 | ### Sexy getter setter 25 | 26 | 27 | 28 | ### Sweet on interface extension 29 | 30 | 31 | 32 | ### Easy selector generation 33 | 34 | 35 | 36 | ### How to use? 37 | 38 | press ctrl+cmd+k, you are ready to go. 39 | 40 | ### How to install? 41 | 42 | plan A: install [Alcatraz](http://alcatraz.io), search for FastStub next. 43 | 44 | plan B: clone this repo, build FastStub on your Mac. 45 | 46 | ### License 47 | MIT 48 | 49 | **☕️orz = International Coffee Begging Protocol = ICBP** 50 | 51 | 52 | 53 | **欢迎关注公众号:** 54 | 55 | 56 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/XCBuildSettings.m: -------------------------------------------------------------------------------- 1 | // 2 | // XCBuildSettings.m 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 11/05/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import "XCBuildSettings.h" 10 | #import "XCTarget+XCProject.h" 11 | #import "NSString+XCAdditions.h" 12 | #import 13 | 14 | static NSString * const XCBuildSettingsCommandFormat = @"xcodebuild -project \"%@\" -target \"%@\" -showBuildSettings"; 15 | 16 | NSString *const XCBuildSettingsSDKROOTKey = @"SDKROOT"; 17 | NSString *const XCBuildSettingsHeaderSearchPathsKey = @"HEADER_SEARCH_PATHS"; 18 | NSString *const XCBuildSettingsUserHeaderSearchPathsKey = @"USER_HEADER_SEARCH_PATHS"; 19 | NSString *const XCBuildSettingsProjectDirKey = @"PROJECT_DIR"; 20 | 21 | @implementation XCBuildSettings 22 | { 23 | NSDictionary *_settings; 24 | } 25 | 26 | + (instancetype)buildSettingsWithTarget:(XCTarget *)target 27 | { 28 | return [[self alloc] initWithTarget:target]; 29 | } 30 | 31 | - (instancetype)initWithTarget:(XCTarget *)target 32 | { 33 | self = [super init]; 34 | if (self) { 35 | _target = target; 36 | } 37 | return self; 38 | } 39 | 40 | - (NSDictionary *)settings 41 | { 42 | if(!_settings) { 43 | NSString *projectPath = [_target.project filePath]; 44 | NSString *command = [NSString stringWithFormat:XCBuildSettingsCommandFormat, projectPath, _target.name]; 45 | NSString *output = [command xcRunAsCommand]; 46 | _settings = [output xcSettingsDictionary]; 47 | } 48 | return _settings; 49 | } 50 | 51 | - (id) valueForKey:(NSString *)key { 52 | return self.settings[key]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCClassDefinition.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 - 2013 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import 14 | #import "XCAbstractDefinition.h" 15 | 16 | typedef enum 17 | { 18 | ObjectiveC, 19 | ObjectiveCPlusPlus, 20 | CPlusPlus, 21 | } ClassDefinitionLanguage; 22 | 23 | @interface XCClassDefinition : XCAbstractDefinition 24 | { 25 | 26 | NSString* _className; 27 | NSString* _header; 28 | NSString* _source; 29 | 30 | @private 31 | ClassDefinitionLanguage _language; 32 | } 33 | 34 | @property(strong, nonatomic, readonly) NSString* className; 35 | @property(nonatomic, strong) NSString* header; 36 | @property(nonatomic, strong) NSString* source; 37 | 38 | + (XCClassDefinition*)classDefinitionWithName:(NSString*)fileName; 39 | 40 | + (XCClassDefinition*)classDefinitionWithName:(NSString*)className language:(ClassDefinitionLanguage)language; 41 | 42 | /** 43 | * Initializes a new objective-c class definition. 44 | */ 45 | - (id)initWithName:(NSString*)fileName; 46 | 47 | /** 48 | * Initializes a new class definition with the specified language. 49 | */ 50 | - (id)initWithName:(NSString*)className language:(ClassDefinitionLanguage)language; 51 | 52 | - (BOOL)isObjectiveC; 53 | 54 | - (BOOL)isObjectiveCPlusPlus; 55 | 56 | - (BOOL)isCPlusPlus; 57 | 58 | - (NSString*)headerFileName; 59 | 60 | - (NSString*)sourceFileName; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCClassDefinition.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 - 2013 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import 14 | #import "XCAbstractDefinition.h" 15 | 16 | typedef enum 17 | { 18 | ObjectiveC, 19 | ObjectiveCPlusPlus, 20 | CPlusPlus, 21 | } ClassDefinitionLanguage; 22 | 23 | @interface XCClassDefinition : XCAbstractDefinition 24 | { 25 | 26 | NSString* _className; 27 | NSString* _header; 28 | NSString* _source; 29 | 30 | @private 31 | ClassDefinitionLanguage _language; 32 | } 33 | 34 | @property(strong, nonatomic, readonly) NSString* className; 35 | @property(nonatomic, strong) NSString* header; 36 | @property(nonatomic, strong) NSString* source; 37 | 38 | + (XCClassDefinition*)classDefinitionWithName:(NSString*)fileName; 39 | 40 | + (XCClassDefinition*)classDefinitionWithName:(NSString*)className language:(ClassDefinitionLanguage)language; 41 | 42 | /** 43 | * Initializes a new objective-c class definition. 44 | */ 45 | - (id)initWithName:(NSString*)fileName; 46 | 47 | /** 48 | * Initializes a new class definition with the specified language. 49 | */ 50 | - (id)initWithName:(NSString*)className language:(ClassDefinitionLanguage)language; 51 | 52 | - (BOOL)isObjectiveC; 53 | 54 | - (BOOL)isObjectiveCPlusPlus; 55 | 56 | - (BOOL)isCPlusPlus; 57 | 58 | - (NSString*)headerFileName; 59 | 60 | - (NSString*)sourceFileName; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /FastStub/Categories/NSString+Files.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Files.m 3 | // MHImportBuster 4 | // 5 | // Created by marko.hlebar on 29/12/13. 6 | // Copyright (c) 2013 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import "NSString+Files.h" 10 | 11 | @implementation NSString (Files) 12 | /** 13 | * Checks if the file path provided is valid 14 | * 15 | * @return YES if file exists at path 16 | */ 17 | -(BOOL) isValidFilePath { 18 | NSFileManager *fileManager = [NSFileManager defaultManager]; 19 | BOOL isDirectory = NO; 20 | return [fileManager fileExistsAtPath:self isDirectory:&isDirectory] && !isDirectory; 21 | } 22 | 23 | /** 24 | * Checks if file path is to a header file 25 | * 26 | * @return YES if file path is to a header file 27 | */ 28 | -(BOOL) isHeaderFilePath { 29 | NSString *extension = [self pathExtension]; 30 | return [extension isEqualToString:@"h"] || [extension isEqualToString:@"hh"]; 31 | } 32 | 33 | /** 34 | * Checks if file path is to an implementation file 35 | * 36 | * @return YES if file path is to an implementation file 37 | */ 38 | -(BOOL) isImplementationFilePath { 39 | NSString *extension = [self pathExtension]; 40 | return [extension isEqualToString:@"m"] || [extension isEqualToString:@"mm"]; 41 | } 42 | 43 | /** 44 | * Adds a suffix to the file path, respecting the file extension. 45 | * 46 | * @param suffix a suffix 47 | * 48 | * @return a file path with added suffix 49 | */ 50 | -(NSString*) filePathByAddingSuffix:(NSString*) suffix { 51 | NSString *extension = [self pathExtension]; 52 | NSString *filePath = self; 53 | if (extension) { 54 | filePath = [filePath stringByDeletingPathExtension]; 55 | } 56 | filePath = [filePath stringByAppendingString:suffix]; 57 | return extension ? [filePath stringByAppendingPathExtension:extension] : filePath; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /FastStub/SysHeaders/FSTextView.txt: -------------------------------------------------------------------------------- 1 | // 2 | // FSTextView.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/17. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | 10 | @protocol UITextViewDelegate 11 | 12 | @optional 13 | 14 | - (BOOL)textViewShouldBeginEditing:(UITextView *)textView; 15 | - (BOOL)textViewShouldEndEditing:(UITextView *)textView; 16 | 17 | - (void)textViewDidBeginEditing:(UITextView *)textView; 18 | - (void)textViewDidEndEditing:(UITextView *)textView; 19 | 20 | - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; 21 | - (void)textViewDidChange:(UITextView *)textView; 22 | 23 | - (void)textViewDidChangeSelection:(UITextView *)textView; 24 | 25 | @end 26 | 27 | 28 | @protocol UITextFieldDelegate 29 | 30 | @optional 31 | 32 | - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField; // return NO to disallow editing. 33 | - (void)textFieldDidBeginEditing:(UITextField *)textField; // became first responder 34 | - (BOOL)textFieldShouldEndEditing:(UITextField *)textField; // return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end 35 | - (void)textFieldDidEndEditing:(UITextField *)textField; // may be called if forced even if shouldEndEditing returns NO (e.g. view removed from window) or endEditing:YES called 36 | 37 | - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string; // return NO to not change text 38 | 39 | - (BOOL)textFieldShouldClear:(UITextField *)textField; // called when clear button pressed. return NO to ignore (no notifications) 40 | - (BOOL)textFieldShouldReturn:(UITextField *)textField; // called when 'return' key pressed. return NO to ignore. 41 | 42 | @end -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCSubProjectDefinition.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import 15 | #import "XCAbstractDefinition.h" 16 | #import "XcodeSourceFileType.h" 17 | 18 | @class XCProject; 19 | 20 | 21 | @interface XCSubProjectDefinition : XCAbstractDefinition 22 | { 23 | 24 | NSString *_name; 25 | NSString *_path; 26 | XcodeSourceFileType _type; 27 | XCProject *_subProject; 28 | XCProject *_parentProject; 29 | NSString *_key; 30 | NSString *_fullProjectPath; 31 | NSString *_relativePath; 32 | } 33 | 34 | 35 | @property (nonatomic, strong, readonly) NSString *name; 36 | @property (nonatomic, strong, readonly) NSString *path; 37 | @property (nonatomic, readonly) XcodeSourceFileType type; 38 | @property (nonatomic, strong, readonly) XCProject *subProject; 39 | @property (nonatomic, strong, readonly) XCProject *parentProject; 40 | @property (nonatomic, strong, readonly) NSString *key; 41 | @property (nonatomic, strong, readwrite) NSString *fullProjectPath; 42 | 43 | + (XCSubProjectDefinition *)withName:(NSString *)name path:(NSString *)path parentProject:(XCProject *)parentProject; 44 | 45 | - (id)initWithName:(NSString *)name path:(NSString *)path parentProject:(XCProject *)parentProject; 46 | 47 | - (NSString *)projectFileName; 48 | 49 | - (NSString *)fullPathName; 50 | 51 | - (NSArray *)buildProductNames; 52 | 53 | - (NSString *)projectKey; 54 | 55 | - (NSString *)pathRelativeToProjectRoot; 56 | 57 | - (void)initFullProjectPath:(NSString *)fullProjectPath groupPath:(NSString *)groupPath; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCXibDefinition.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import "XCXibDefinition.h" 14 | 15 | @implementation XCXibDefinition 16 | 17 | @synthesize name = _name; 18 | @synthesize content = _content; 19 | 20 | /* ====================================================================================================================================== */ 21 | #pragma mark - Class Methods 22 | 23 | + (XCXibDefinition*)xibDefinitionWithName:(NSString*)name 24 | { 25 | return [[XCXibDefinition alloc] initWithName:name]; 26 | } 27 | 28 | + (XCXibDefinition*)xibDefinitionWithName:(NSString*)name content:(NSString*)content 29 | { 30 | return [[XCXibDefinition alloc] initWithName:name content:content]; 31 | } 32 | 33 | 34 | /* ====================================================================================================================================== */ 35 | #pragma mark - Initialization & Destruction 36 | 37 | - (id)initWithName:(NSString*)name 38 | { 39 | return [self initWithName:name content:nil]; 40 | } 41 | 42 | 43 | - (id)initWithName:(NSString*)name content:(NSString*)content 44 | { 45 | self = [super init]; 46 | if (self) 47 | { 48 | _name = [name copy]; 49 | _content = [content copy]; 50 | } 51 | return self; 52 | } 53 | 54 | 55 | /* ====================================================================================================================================== */ 56 | #pragma mark - Interface Methods 57 | 58 | - (NSString*)xibFileName 59 | { 60 | return [_name stringByAppendingString:@".xib"]; 61 | } 62 | 63 | @end -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCSubProjectDefinition.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import 15 | #import "XCAbstractDefinition.h" 16 | #import "XcodeSourceFileType.h" 17 | 18 | @class XCProject; 19 | 20 | 21 | @interface XCSubProjectDefinition : XCAbstractDefinition 22 | { 23 | 24 | NSString *_name; 25 | NSString *_path; 26 | XcodeSourceFileType _type; 27 | XCProject *_subProject; 28 | XCProject *_parentProject; 29 | NSString *_key; 30 | NSString *_fullProjectPath; 31 | NSString *_relativePath; 32 | } 33 | 34 | 35 | @property (nonatomic, strong, readonly) NSString *name; 36 | @property (nonatomic, strong, readonly) NSString *path; 37 | @property (nonatomic, readonly) XcodeSourceFileType type; 38 | @property (nonatomic, strong, readonly) XCProject *subProject; 39 | @property (nonatomic, strong, readonly) XCProject *parentProject; 40 | @property (nonatomic, strong, readonly) NSString *key; 41 | @property (nonatomic, strong, readwrite) NSString *fullProjectPath; 42 | 43 | + (XCSubProjectDefinition *)withName:(NSString *)name path:(NSString *)path parentProject:(XCProject *)parentProject; 44 | 45 | - (id)initWithName:(NSString *)name path:(NSString *)path parentProject:(XCProject *)parentProject; 46 | 47 | - (NSString *)projectFileName; 48 | 49 | - (NSString *)fullPathName; 50 | 51 | - (NSArray *)buildProductNames; 52 | 53 | - (NSString *)projectKey; 54 | 55 | - (NSString *)pathRelativeToProjectRoot; 56 | 57 | - (void)initFullProjectPath:(NSString *)fullProjectPath groupPath:(NSString *)groupPath; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCXibDefinition.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import "XCXibDefinition.h" 14 | 15 | @implementation XCXibDefinition 16 | 17 | @synthesize name = _name; 18 | @synthesize content = _content; 19 | 20 | /* ====================================================================================================================================== */ 21 | #pragma mark - Class Methods 22 | 23 | + (XCXibDefinition*)xibDefinitionWithName:(NSString*)name 24 | { 25 | return [[XCXibDefinition alloc] initWithName:name]; 26 | } 27 | 28 | + (XCXibDefinition*)xibDefinitionWithName:(NSString*)name content:(NSString*)content 29 | { 30 | return [[XCXibDefinition alloc] initWithName:name content:content]; 31 | } 32 | 33 | 34 | /* ====================================================================================================================================== */ 35 | #pragma mark - Initialization & Destruction 36 | 37 | - (id)initWithName:(NSString*)name 38 | { 39 | return [self initWithName:name content:nil]; 40 | } 41 | 42 | 43 | - (id)initWithName:(NSString*)name content:(NSString*)content 44 | { 45 | self = [super init]; 46 | if (self) 47 | { 48 | _name = [name copy]; 49 | _content = [content copy]; 50 | } 51 | return self; 52 | } 53 | 54 | 55 | /* ====================================================================================================================================== */ 56 | #pragma mark - Interface Methods 57 | 58 | - (NSString*)xibFileName 59 | { 60 | return [_name stringByAppendingString:@".xib"]; 61 | } 62 | 63 | @end -------------------------------------------------------------------------------- /FastStub/Categories/DVTSourceTextStorage+Operations.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVTSourceTextStorage+Operations.m 3 | // MHImportBuster 4 | // 5 | // Created by Marko Hlebar on 08/02/2014. 6 | // Copyright (c) 2014 Marko Hlebar. All rights reserved. 7 | // 8 | 9 | #import "DVTSourceTextStorage+Operations.h" 10 | #import "XCFXcodePrivate.h" 11 | #import "MHXcodeDocumentNavigator.h" 12 | #import "NSString+MHNSRange.h" 13 | 14 | @implementation NSTextStorage (MHOperations) 15 | 16 | - (void)mhInsertString:(NSString *)string atLine:(NSUInteger)lineNumber { 17 | NSRange range = [self.string mhRangeOfLine:lineNumber]; 18 | range.length = 0; 19 | //edge case when string is out of bounds 20 | if (range.location == NSNotFound) { 21 | range = NSMakeRange(self.length, 0); 22 | // NSString *newLine = @"\n"; 23 | // string = [newLine stringByAppendingString:string]; 24 | }; 25 | [self mhReplaceCharactersInRange:range withString:string]; 26 | } 27 | 28 | - (void)mhDeleteLine:(NSInteger)lineNumber { 29 | NSRange range = [self.string mhRangeOfLine:lineNumber]; 30 | if (range.location != NSNotFound) { 31 | [self mhReplaceCharactersInRange:range withString:@""]; 32 | } 33 | } 34 | 35 | - (void)mhDeleteLines:(NSIndexSet *)lineNumbers { 36 | __block NSInteger offset = 0; 37 | [lineNumbers enumerateIndexesUsingBlock: ^(NSUInteger index, BOOL *stop) { 38 | NSInteger indexToDelete = index - offset; 39 | [self mhDeleteLine:indexToDelete]; 40 | offset++; 41 | }]; 42 | } 43 | 44 | - (void)mhReplaceCharactersInRange:(NSRange)range withString:(NSString *)string { 45 | if ([self respondsToSelector:@selector(replaceCharactersInRange:withString:withUndoManager:)]) { 46 | IDESourceCodeDocument *document = [MHXcodeDocumentNavigator currentSourceCodeDocument]; 47 | DVTSourceTextStorage *storage = (DVTSourceTextStorage *)self; 48 | [storage replaceCharactersInRange:range 49 | withString:string 50 | withUndoManager:document.undoManager]; 51 | } 52 | else { 53 | [self replaceCharactersInRange:range 54 | withString:string]; 55 | } 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XcodeSourceFileType.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | #import 13 | 14 | typedef NS_OPTIONS(NSInteger, XcodeSourceFileType) 15 | { 16 | FileTypeNil = 0, // Unknown filetype 17 | Framework = 1, // .framework 18 | PropertyList = 2, // .plist 19 | SourceCodeHeader = 3, // .h 20 | SourceCodeObjC = 4, // .m 21 | SourceCodeObjCPlusPlus = 5, // .mm 22 | SourceCodeCPlusPlus = 6, // .cpp 23 | XibFile = 7, // .xib 24 | ImageResourcePNG = 8, // .png 25 | Bundle = 9, // .bundle .octet 26 | Archive = 10, // .a files 27 | HTML = 11, // HTML file 28 | TEXT = 12, // Some text file 29 | XcodeProject = 13, // .xcodeproj 30 | Folder = 14, // a Folder reference 31 | AssetCatalog = 15, // Assets 32 | SourceCodeSwift = 16, // .swift 33 | Application = 17, // .app (wrapper.application) 34 | Playground = 18, // .playground (file.playground) 35 | ShellScript = 19, // no suffix Xcode seems to detect (text.script.sh) 36 | Markdown = 20, // .md (net.daringfileball.markdown) 37 | XMLPropertyList = 21, // .plist (text.plist.xml) 38 | Storyboard = 22, // .storyboard (file.storyboard) 39 | XCConfig = 23 // .xcconfig 40 | }; 41 | 42 | NSString* NSStringFromXCSourceFileType(XcodeSourceFileType type); 43 | 44 | XcodeSourceFileType XCSourceFileTypeFromStringRepresentation(NSString* string); 45 | 46 | XcodeSourceFileType XCSourceFileTypeFromFileName(NSString* fileName); 47 | 48 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XcodeSourceFileType.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | #import 13 | 14 | typedef NS_OPTIONS(NSInteger, XcodeSourceFileType) 15 | { 16 | FileTypeNil = 0, // Unknown filetype 17 | Framework = 1, // .framework 18 | PropertyList = 2, // .plist 19 | SourceCodeHeader = 3, // .h 20 | SourceCodeObjC = 4, // .m 21 | SourceCodeObjCPlusPlus = 5, // .mm 22 | SourceCodeCPlusPlus = 6, // .cpp 23 | XibFile = 7, // .xib 24 | ImageResourcePNG = 8, // .png 25 | Bundle = 9, // .bundle .octet 26 | Archive = 10, // .a files 27 | HTML = 11, // HTML file 28 | TEXT = 12, // Some text file 29 | XcodeProject = 13, // .xcodeproj 30 | Folder = 14, // a Folder reference 31 | AssetCatalog = 15, // Assets 32 | SourceCodeSwift = 16, // .swift 33 | Application = 17, // .app (wrapper.application) 34 | Playground = 18, // .playground (file.playground) 35 | ShellScript = 19, // no suffix Xcode seems to detect (text.script.sh) 36 | Markdown = 20, // .md (net.daringfileball.markdown) 37 | XMLPropertyList = 21, // .plist (text.plist.xml) 38 | Storyboard = 22, // .storyboard (file.storyboard) 39 | XCConfig = 23 // .xcconfig 40 | }; 41 | 42 | NSString* NSStringFromXCSourceFileType(XcodeSourceFileType type); 43 | 44 | XcodeSourceFileType XCSourceFileTypeFromStringRepresentation(NSString* string); 45 | 46 | XcodeSourceFileType XCSourceFileTypeFromFileName(NSString* fileName); 47 | 48 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCFrameworkDefinition.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import "XCFrameworkDefinition.h" 15 | #import "XCProject.h" 16 | 17 | @implementation XCFrameworkDefinition 18 | 19 | @synthesize filePath = _filePath; 20 | @synthesize copyToDestination = _copyToDestination; 21 | 22 | //------------------------------------------------------------------------------------------- 23 | #pragma mark - Class Methods 24 | //------------------------------------------------------------------------------------------- 25 | 26 | + (XCFrameworkDefinition *)frameworkDefinitionWithFilePath:(NSString *)filePath 27 | copyToDestination:(BOOL)copyToDestination 28 | { 29 | 30 | return [[XCFrameworkDefinition alloc] initWithFilePath:filePath copyToDestination:copyToDestination]; 31 | } 32 | 33 | //------------------------------------------------------------------------------------------- 34 | #pragma mark - Initialization & Destruction 35 | //------------------------------------------------------------------------------------------- 36 | 37 | - (id)initWithFilePath:(NSString *)filePath copyToDestination:(BOOL)copyToDestination 38 | { 39 | self = [super init]; 40 | if (self) { 41 | _filePath = [filePath copy]; 42 | _copyToDestination = copyToDestination; 43 | } 44 | return self; 45 | } 46 | 47 | //------------------------------------------------------------------------------------------- 48 | #pragma mark - Interface Methods 49 | //------------------------------------------------------------------------------------------- 50 | 51 | - (NSString *)fileName 52 | { 53 | return [[_filePath lastPathComponent] stringByReplacingOccurrencesOfString:@"/" withString:@""]; 54 | } 55 | 56 | 57 | 58 | @end -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCFrameworkDefinition.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import "XCFrameworkDefinition.h" 15 | #import "XCProject.h" 16 | 17 | @implementation XCFrameworkDefinition 18 | 19 | @synthesize filePath = _filePath; 20 | @synthesize copyToDestination = _copyToDestination; 21 | 22 | //------------------------------------------------------------------------------------------- 23 | #pragma mark - Class Methods 24 | //------------------------------------------------------------------------------------------- 25 | 26 | + (XCFrameworkDefinition *)frameworkDefinitionWithFilePath:(NSString *)filePath 27 | copyToDestination:(BOOL)copyToDestination 28 | { 29 | 30 | return [[XCFrameworkDefinition alloc] initWithFilePath:filePath copyToDestination:copyToDestination]; 31 | } 32 | 33 | //------------------------------------------------------------------------------------------- 34 | #pragma mark - Initialization & Destruction 35 | //------------------------------------------------------------------------------------------- 36 | 37 | - (id)initWithFilePath:(NSString *)filePath copyToDestination:(BOOL)copyToDestination 38 | { 39 | self = [super init]; 40 | if (self) { 41 | _filePath = [filePath copy]; 42 | _copyToDestination = copyToDestination; 43 | } 44 | return self; 45 | } 46 | 47 | //------------------------------------------------------------------------------------------- 48 | #pragma mark - Interface Methods 49 | //------------------------------------------------------------------------------------------- 50 | 51 | - (NSString *)fileName 52 | { 53 | return [[_filePath lastPathComponent] stringByReplacingOccurrencesOfString:@"/" withString:@""]; 54 | } 55 | 56 | 57 | 58 | @end -------------------------------------------------------------------------------- /FastStub/Processors/FSProtocolProcessor.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSProtocolProcessor.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSProtocolProcessor.h" 10 | #import "FSElementPool.h" 11 | #import "FSElementCache.h" 12 | 13 | @implementation FSProtocolProcessor 14 | 15 | - (NSString *)pattern { 16 | return @"(@protocol)\\s+([a-z][a-z0-9_\\s*\()]+)(.*?)(@end+?)"; 17 | } 18 | 19 | - (FSElementCacheType)getElementType 20 | { 21 | return FSElementCacheProtocol; 22 | } 23 | 24 | - (NSArray *)createElements:(NSString *)content { 25 | NSMutableArray *array = [NSMutableArray array]; 26 | [self processContent:content resultBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop) { 27 | FSElementCache* element = [self createClassElement:match from:content]; 28 | if (element) { 29 | [array addObject:element]; 30 | } 31 | }]; 32 | 33 | return array; 34 | } 35 | 36 | - (FSElementCache *)createClassElement:(NSTextCheckingResult *)match from:(NSString *)content { 37 | NSRange matchRange = [match rangeAtIndex:2]; 38 | NSString *matchString = [content substringWithRange:matchRange]; 39 | NSString *matchTrim = [matchString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 40 | if ([matchTrim rangeOfString:@"("].location == NSNotFound) { 41 | NSRange matchRange = [match rangeAtIndex:2]; 42 | NSString *matchString = [content substringWithRange:matchRange]; 43 | NSString *matchTrim = [matchString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 44 | 45 | FSElementCache *element = [FSElementCache new]; 46 | element.elementName = matchTrim; 47 | element.elementType = FSElementCacheProtocol; 48 | 49 | NSRange matchProtocolRange = [match rangeAtIndex:3]; 50 | NSString* matchProtocolString = [content substringWithRange:matchProtocolRange]; 51 | element.methodList = [self buildMethodList:matchProtocolString].mutableCopy; 52 | 53 | 54 | return element; 55 | } 56 | 57 | return nil; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /FastStub/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 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 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | DVTPlugInCompatibilityUUIDs 26 | 27 | 7265231C-39B4-402C-89E1-16167C4CC990 28 | 0420B86A-AA43-4792-9ED0-6FE0F2B16A13 29 | CC0D0F4F-05B3-431A-8F33-F84AFCB2C651 30 | 0420B86A-AA43-4792-9ED0-6FE0F2B16A13 31 | 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90 32 | AABB7188-E14E-4433-AD3B-5CD791EAD9A3 33 | FEC992CC-CA4A-4CFD-8881-77300FCB848A 34 | AD68E85B-441B-4301-B564-A45E4919A6AD 35 | A2E4D43F-41F4-4FB9-BB94-7177011C9AED 36 | 640F884E-CE55-4B40-87C0-8869546CAB7A 37 | 37B30044-3B14-46BA-ABAA-F01000C27B63 38 | C4A681B0-4A26-480E-93EC-1218098B9AA0 39 | A16FF353-8441-459E-A50C-B071F53F51B7 40 | 9F75337B-21B4-4ADC-B558-F9CADF7073A7 41 | E969541F-E6F9-4D25-8158-72DC3545A6C6 42 | 9AFF134A-08DC-4096-8CEE-62A4BB123046 43 | F41BD31E-2683-44B8-AE7F-5F09E919790E 44 | ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C 45 | 46 | NSPrincipalClass 47 | FastStub 48 | XC4Compatible 49 | 50 | XC5Compatible 51 | 52 | XCGCReady 53 | 54 | XCPluginHasUI 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCTarget.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import 14 | 15 | @class XCProject; 16 | @class XCSourceFile; 17 | @class XCProjectBuildConfig; 18 | 19 | /** 20 | * Represents a target in an xcode project. 21 | */ 22 | @interface XCTarget : NSObject 23 | { 24 | 25 | XCProject* _project; 26 | NSString* _key; 27 | NSString* _name; 28 | NSString* _productName; 29 | NSString* _productReference; 30 | NSString* _defaultConfigurationName; 31 | 32 | @private 33 | NSMutableArray* _members; 34 | NSMutableArray* _resources; 35 | NSMutableDictionary* _configurations; 36 | } 37 | 38 | @property(nonatomic, strong, readonly) NSString* key; 39 | @property(nonatomic, strong) NSString* name; 40 | @property(nonatomic, strong) NSString* productName; 41 | @property(nonatomic, strong, readonly) NSString* productReference; 42 | 43 | + (XCTarget*)targetWithProject:(XCProject*)project key:(NSString*)key name:(NSString*)name productName:(NSString*)productName 44 | productReference:(NSString*)productReference; 45 | 46 | - (id)initWithProject:(XCProject*)project key:(NSString*)key name:(NSString*)name productName:(NSString*)productName 47 | productReference:(NSString*)productReference; 48 | 49 | - (NSArray*)resources; 50 | 51 | - (NSArray*)members; 52 | 53 | - (NSDictionary*)configurations; 54 | 55 | - (XCProjectBuildConfig *)configurationWithName:(NSString*)name; 56 | 57 | - (XCProjectBuildConfig *)defaultConfiguration; 58 | 59 | - (void)addMember:(XCSourceFile*)member; 60 | 61 | - (void)removeMemberWithKey:(NSString*)key; 62 | 63 | - (void)removeMembersWithKeys:(NSArray*)keys; 64 | 65 | - (void)addDependency:(NSString*)key; 66 | 67 | - (instancetype)duplicateWithTargetName:(NSString*)targetName productName:(NSString*)productName; 68 | 69 | @end 70 | 71 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCTarget.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #import 14 | 15 | @class XCProject; 16 | @class XCSourceFile; 17 | @class XCProjectBuildConfig; 18 | 19 | /** 20 | * Represents a target in an xcode project. 21 | */ 22 | @interface XCTarget : NSObject 23 | { 24 | 25 | XCProject* _project; 26 | NSString* _key; 27 | NSString* _name; 28 | NSString* _productName; 29 | NSString* _productReference; 30 | NSString* _defaultConfigurationName; 31 | 32 | @private 33 | NSMutableArray* _members; 34 | NSMutableArray* _resources; 35 | NSMutableDictionary* _configurations; 36 | } 37 | 38 | @property(nonatomic, strong, readonly) NSString* key; 39 | @property(nonatomic, strong) NSString* name; 40 | @property(nonatomic, strong) NSString* productName; 41 | @property(nonatomic, strong, readonly) NSString* productReference; 42 | 43 | + (XCTarget*)targetWithProject:(XCProject*)project key:(NSString*)key name:(NSString*)name productName:(NSString*)productName 44 | productReference:(NSString*)productReference; 45 | 46 | - (id)initWithProject:(XCProject*)project key:(NSString*)key name:(NSString*)name productName:(NSString*)productName 47 | productReference:(NSString*)productReference; 48 | 49 | - (NSArray*)resources; 50 | 51 | - (NSArray*)members; 52 | 53 | - (NSDictionary*)configurations; 54 | 55 | - (XCProjectBuildConfig *)configurationWithName:(NSString*)name; 56 | 57 | - (XCProjectBuildConfig *)defaultConfiguration; 58 | 59 | - (void)addMember:(XCSourceFile*)member; 60 | 61 | - (void)removeMemberWithKey:(NSString*)key; 62 | 63 | - (void)removeMembersWithKeys:(NSArray*)keys; 64 | 65 | - (void)addDependency:(NSString*)key; 66 | 67 | - (instancetype)duplicateWithTargetName:(NSString*)targetName productName:(NSString*)productName; 68 | 69 | @end 70 | 71 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCSourceFile.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import 15 | #import "XcodeGroupMember.h" 16 | #import "XcodeSourceFileType.h" 17 | 18 | @class XCProject; 19 | 20 | /** 21 | * Represents a file resource in an xcode project. 22 | */ 23 | @interface XCSourceFile : NSObject 24 | { 25 | 26 | @private 27 | XCProject *_project; 28 | 29 | NSNumber *_isBuildFile; 30 | NSString *_buildFileKey; 31 | NSString *_name; 32 | NSString *_sourceTree; 33 | NSString *_key; 34 | NSString *_path; 35 | XcodeSourceFileType _type; 36 | } 37 | 38 | @property (nonatomic, readonly) XcodeSourceFileType type; 39 | @property (nonatomic, strong, readonly) NSString *key; 40 | @property (nonatomic, strong) NSString *name; 41 | @property (nonatomic, strong, readonly) NSString *sourceTree; 42 | @property (nonatomic, strong) NSString *path; 43 | 44 | + (XCSourceFile *)sourceFileWithProject:(XCProject *)project key:(NSString *)key type:(XcodeSourceFileType)type 45 | name:(NSString *)name sourceTree:(NSString *)tree path:(NSString *)path; 46 | 47 | - (id)initWithProject:(XCProject *)project key:(NSString *)key type:(XcodeSourceFileType)type name:(NSString *)name 48 | sourceTree:(NSString *)tree path:(NSString *)path; 49 | 50 | /** 51 | * If yes, indicates the file is able to be included for compilation in an `XCTarget`. 52 | */ 53 | - (BOOL)isBuildFile; 54 | 55 | - (BOOL)canBecomeBuildFile; 56 | 57 | - (XcodeMemberType)buildPhase; 58 | 59 | - (NSString *)buildFileKey; 60 | 61 | /** 62 | * Adds this file to the project as an `xcode_BuildFile`, ready to be included in targets. 63 | */ 64 | - (void)becomeBuildFile; 65 | 66 | /** 67 | * Method for setting Compiler Flags for individual build files 68 | * 69 | * @param value String value to set in Compiler Flags 70 | */ 71 | - (void)setCompilerFlags:(NSString *)value; 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCSourceFile.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import 15 | #import "XcodeGroupMember.h" 16 | #import "XcodeSourceFileType.h" 17 | 18 | @class XCProject; 19 | 20 | /** 21 | * Represents a file resource in an xcode project. 22 | */ 23 | @interface XCSourceFile : NSObject 24 | { 25 | 26 | @private 27 | XCProject *_project; 28 | 29 | NSNumber *_isBuildFile; 30 | NSString *_buildFileKey; 31 | NSString *_name; 32 | NSString *_sourceTree; 33 | NSString *_key; 34 | NSString *_path; 35 | XcodeSourceFileType _type; 36 | } 37 | 38 | @property (nonatomic, readonly) XcodeSourceFileType type; 39 | @property (nonatomic, strong, readonly) NSString *key; 40 | @property (nonatomic, strong) NSString *name; 41 | @property (nonatomic, strong, readonly) NSString *sourceTree; 42 | @property (nonatomic, strong) NSString *path; 43 | 44 | + (XCSourceFile *)sourceFileWithProject:(XCProject *)project key:(NSString *)key type:(XcodeSourceFileType)type 45 | name:(NSString *)name sourceTree:(NSString *)tree path:(NSString *)path; 46 | 47 | - (id)initWithProject:(XCProject *)project key:(NSString *)key type:(XcodeSourceFileType)type name:(NSString *)name 48 | sourceTree:(NSString *)tree path:(NSString *)path; 49 | 50 | /** 51 | * If yes, indicates the file is able to be included for compilation in an `XCTarget`. 52 | */ 53 | - (BOOL)isBuildFile; 54 | 55 | - (BOOL)canBecomeBuildFile; 56 | 57 | - (XcodeMemberType)buildPhase; 58 | 59 | - (NSString *)buildFileKey; 60 | 61 | /** 62 | * Adds this file to the project as an `xcode_BuildFile`, ready to be included in targets. 63 | */ 64 | - (void)becomeBuildFile; 65 | 66 | /** 67 | * Method for setting Compiler Flags for individual build files 68 | * 69 | * @param value String value to set in Compiler Flags 70 | */ 71 | - (void)setCompilerFlags:(NSString *)value; 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /FastStub/SysHeaders/FSScrollView.txt: -------------------------------------------------------------------------------- 1 | // 2 | // FSScrollView.h 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/17. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | 10 | @protocol UIScrollViewDelegate 11 | 12 | @optional 13 | 14 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView; // any offset changes 15 | - (void)scrollViewDidZoom:(UIScrollView *)scrollView; // any zoom scale changes 16 | 17 | // called on start of dragging (may require some time and or distance to move) 18 | - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView; 19 | // called on finger up if the user dragged. velocity is in points/millisecond. targetContentOffset may be changed to adjust where the scroll view comes to rest 20 | - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset NS_AVAILABLE_IOS(5_0); 21 | // called on finger up if the user dragged. decelerate is true if it will continue moving afterwards 22 | - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate; 23 | 24 | - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView; // called on finger up as we are moving 25 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; // called when scroll view grinds to a halt 26 | 27 | - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView; // called when setContentOffset/scrollRectVisible:animated: finishes. not called if not animating 28 | 29 | - (nullable UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView; // return a view that will be scaled. if delegate returns nil, nothing happens 30 | - (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(nullable UIView *)view; // called before the scroll view begins zooming its content 31 | - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(nullable UIView *)view atScale:(CGFloat)scale; // scale between minimum and maximum. called after any 'bounce' animations 32 | 33 | - (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView; // return a yes if you want to scroll to the top. if not defined, assumes YES 34 | - (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView; // called when scrolling animation finished. may be called immediately if already at top 35 | 36 | @end -------------------------------------------------------------------------------- /FastStub/FastStub.m: -------------------------------------------------------------------------------- 1 | // 2 | // FastStub.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/7. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FastStub.h" 10 | #import 11 | #import "FastStubInspector.h" 12 | #import "FSIDENotificationHandler.h" 13 | 14 | @interface FastStub() 15 | 16 | @property (nonatomic, strong, readwrite) NSBundle *bundle; 17 | @end 18 | 19 | @implementation FastStub 20 | 21 | + (instancetype)sharedPlugin 22 | { 23 | return sharedPlugin; 24 | } 25 | 26 | - (id)initWithBundle:(NSBundle *)plugin 27 | { 28 | if (self = [super init]) { 29 | // reference to plugin's bundle, for resource access 30 | self.bundle = plugin; 31 | [[NSNotificationCenter defaultCenter] addObserver:self 32 | selector:@selector(didApplicationFinishLaunchingNotification:) 33 | name:NSApplicationDidFinishLaunchingNotification 34 | object:nil]; 35 | } 36 | return self; 37 | } 38 | 39 | - (void)didApplicationFinishLaunchingNotification:(NSNotification*)noti 40 | { 41 | //removeObserver 42 | [[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationDidFinishLaunchingNotification object:nil]; 43 | 44 | [FastStubInspector sharedInstance]; 45 | [FSIDENotificationHandler sharedInstance]; 46 | 47 | //add menu item 48 | [self insertMenuItem]; 49 | } 50 | 51 | - (void)insertMenuItem 52 | { 53 | NSMenuItem *menuItem = [[NSApp mainMenu] itemWithTitle:@"Edit"]; 54 | if (menuItem) { 55 | [[menuItem submenu] addItem:[NSMenuItem separatorItem]]; 56 | NSMenuItem *actionMenuItem = [[NSMenuItem alloc] initWithTitle:@"Suggest Stub" action:@selector(doMenuAction) keyEquivalent:@""]; 57 | 58 | [actionMenuItem setKeyEquivalent:@"k"]; 59 | [actionMenuItem setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask]; 60 | [actionMenuItem setTarget:self]; 61 | [[menuItem submenu] addItem:actionMenuItem]; 62 | } 63 | } 64 | 65 | - (void)doMenuAction 66 | { 67 | [[NSNotificationCenter defaultCenter] postNotificationName:@"FSShowSuggestion" object:nil]; 68 | } 69 | 70 | - (void)dealloc 71 | { 72 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/Utils/XCKeyBuilder.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 - 2013 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | #import "XCKeyBuilder.h" 13 | #import 14 | 15 | #if MD5_DIGEST_LENGTH != CC_MD5_DIGEST_LENGTH 16 | #error Digest length in XCKeyBuilder.h (MD5_DIGEST_LENGTH) disagress with CommonCrypto value (CC_MD5_DIGEST_LENGTH) 17 | #endif 18 | 19 | @implementation XCKeyBuilder 20 | 21 | //------------------------------------------------------------------------------------------- 22 | #pragma mark - Class Methods 23 | //------------------------------------------------------------------------------------------- 24 | 25 | + (XCKeyBuilder*)forItemNamed:(NSString*)name 26 | { 27 | return [self createUnique]; 28 | } 29 | 30 | + (XCKeyBuilder*)createUnique 31 | { 32 | CFUUIDRef theUUID = CFUUIDCreate(NULL); 33 | CFUUIDBytes bytes = CFUUIDGetUUIDBytes(theUUID); 34 | CFRelease(theUUID); 35 | 36 | return [[XCKeyBuilder alloc] initHashValueMD5HashWithBytes:&bytes length:sizeof(bytes)]; 37 | } 38 | 39 | //------------------------------------------------------------------------------------------- 40 | #pragma mark - Initialization & Destruction 41 | //------------------------------------------------------------------------------------------- 42 | 43 | - (id)initHashValueMD5HashWithBytes:(const void*)bytes length:(NSUInteger)length 44 | { 45 | self = [super init]; 46 | if (self != nil) 47 | { 48 | CC_MD5(bytes, (int) length, _value); 49 | } 50 | return self; 51 | } 52 | 53 | //------------------------------------------------------------------------------------------- 54 | #pragma mark - Interface Methods 55 | //------------------------------------------------------------------------------------------- 56 | 57 | - (NSString*)build 58 | { 59 | NSInteger byteLength = sizeof(HashValueMD5Hash); 60 | NSMutableString* stringValue = [NSMutableString stringWithCapacity:byteLength * 2]; 61 | NSInteger i; 62 | for (i = 0; i < byteLength; i++) 63 | { 64 | [stringValue appendFormat:@"%02x", _value[i]]; 65 | } 66 | return [[stringValue substringToIndex:24] uppercaseString]; 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/Utils/XCKeyBuilder.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 - 2013 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | #import "XCKeyBuilder.h" 13 | #import 14 | 15 | #if MD5_DIGEST_LENGTH != CC_MD5_DIGEST_LENGTH 16 | #error Digest length in XCKeyBuilder.h (MD5_DIGEST_LENGTH) disagress with CommonCrypto value (CC_MD5_DIGEST_LENGTH) 17 | #endif 18 | 19 | @implementation XCKeyBuilder 20 | 21 | //------------------------------------------------------------------------------------------- 22 | #pragma mark - Class Methods 23 | //------------------------------------------------------------------------------------------- 24 | 25 | + (XCKeyBuilder*)forItemNamed:(NSString*)name 26 | { 27 | return [self createUnique]; 28 | } 29 | 30 | + (XCKeyBuilder*)createUnique 31 | { 32 | CFUUIDRef theUUID = CFUUIDCreate(NULL); 33 | CFUUIDBytes bytes = CFUUIDGetUUIDBytes(theUUID); 34 | CFRelease(theUUID); 35 | 36 | return [[XCKeyBuilder alloc] initHashValueMD5HashWithBytes:&bytes length:sizeof(bytes)]; 37 | } 38 | 39 | //------------------------------------------------------------------------------------------- 40 | #pragma mark - Initialization & Destruction 41 | //------------------------------------------------------------------------------------------- 42 | 43 | - (id)initHashValueMD5HashWithBytes:(const void*)bytes length:(NSUInteger)length 44 | { 45 | self = [super init]; 46 | if (self != nil) 47 | { 48 | CC_MD5(bytes, (int) length, _value); 49 | } 50 | return self; 51 | } 52 | 53 | //------------------------------------------------------------------------------------------- 54 | #pragma mark - Interface Methods 55 | //------------------------------------------------------------------------------------------- 56 | 57 | - (NSString*)build 58 | { 59 | NSInteger byteLength = sizeof(HashValueMD5Hash); 60 | NSMutableString* stringValue = [NSMutableString stringWithCapacity:byteLength * 2]; 61 | NSInteger i; 62 | for (i = 0; i < byteLength; i++) 63 | { 64 | [stringValue appendFormat:@"%02x", _value[i]]; 65 | } 66 | return [[stringValue substringToIndex:24] uppercaseString]; 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCSourceFileDefinition.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import "XCSourceFileDefinition.h" 15 | 16 | @implementation XCSourceFileDefinition 17 | 18 | @synthesize sourceFileName = _sourceFileName; 19 | @synthesize type = _type; 20 | @synthesize data = _data; 21 | 22 | /* ====================================================================================================================================== */ 23 | #pragma mark - Class Methods 24 | 25 | + (XCSourceFileDefinition*)sourceDefinitionWithName:(NSString*)name text:(NSString*)text type:(XcodeSourceFileType)type 26 | { 27 | 28 | return [[XCSourceFileDefinition alloc] initWithName:name text:text type:type]; 29 | } 30 | 31 | + (XCSourceFileDefinition*)sourceDefinitionWithName:(NSString*)name data:(NSData*)data type:(XcodeSourceFileType)type 32 | { 33 | 34 | return [[XCSourceFileDefinition alloc] initWithName:name data:data type:type]; 35 | } 36 | 37 | + (XCSourceFileDefinition*)sourceDefinitionWithAssetCatalogName:(NSString*)name 38 | { 39 | XCSourceFileDefinition *definition = [[XCSourceFileDefinition alloc] initWithName:name type:AssetCatalog]; 40 | definition.fileOperationType = XCFileOperationTypeReferenceOnly; 41 | return definition; 42 | } 43 | 44 | 45 | /* ====================================================================================================================================== */ 46 | #pragma mark - Initialization & Destruction 47 | 48 | - (id)initWithName:(NSString*)name text:(NSString*)text type:(XcodeSourceFileType)type 49 | { 50 | self = [super init]; 51 | if (self) 52 | { 53 | _sourceFileName = [name copy]; 54 | _data = [[text dataUsingEncoding:NSUTF8StringEncoding] copy]; 55 | _type = type; 56 | } 57 | return self; 58 | } 59 | 60 | - (id)initWithName:(NSString*)name data:(NSData*)data type:(XcodeSourceFileType)type 61 | { 62 | self = [super init]; 63 | if (self) 64 | { 65 | _sourceFileName = [name copy]; 66 | _data = [data copy]; 67 | _type = type; 68 | } 69 | return self; 70 | 71 | } 72 | 73 | - (id)initWithName:(NSString*)name type:(XcodeSourceFileType)type 74 | { 75 | self = [super init]; 76 | if (self) 77 | { 78 | _sourceFileName = [name copy]; 79 | _type = type; 80 | } 81 | return self; 82 | } 83 | 84 | 85 | @end -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCSourceFileDefinition.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import "XCSourceFileDefinition.h" 15 | 16 | @implementation XCSourceFileDefinition 17 | 18 | @synthesize sourceFileName = _sourceFileName; 19 | @synthesize type = _type; 20 | @synthesize data = _data; 21 | 22 | /* ====================================================================================================================================== */ 23 | #pragma mark - Class Methods 24 | 25 | + (XCSourceFileDefinition*)sourceDefinitionWithName:(NSString*)name text:(NSString*)text type:(XcodeSourceFileType)type 26 | { 27 | 28 | return [[XCSourceFileDefinition alloc] initWithName:name text:text type:type]; 29 | } 30 | 31 | + (XCSourceFileDefinition*)sourceDefinitionWithName:(NSString*)name data:(NSData*)data type:(XcodeSourceFileType)type 32 | { 33 | 34 | return [[XCSourceFileDefinition alloc] initWithName:name data:data type:type]; 35 | } 36 | 37 | + (XCSourceFileDefinition*)sourceDefinitionWithAssetCatalogName:(NSString*)name 38 | { 39 | XCSourceFileDefinition *definition = [[XCSourceFileDefinition alloc] initWithName:name type:AssetCatalog]; 40 | definition.fileOperationType = XCFileOperationTypeReferenceOnly; 41 | return definition; 42 | } 43 | 44 | 45 | /* ====================================================================================================================================== */ 46 | #pragma mark - Initialization & Destruction 47 | 48 | - (id)initWithName:(NSString*)name text:(NSString*)text type:(XcodeSourceFileType)type 49 | { 50 | self = [super init]; 51 | if (self) 52 | { 53 | _sourceFileName = [name copy]; 54 | _data = [[text dataUsingEncoding:NSUTF8StringEncoding] copy]; 55 | _type = type; 56 | } 57 | return self; 58 | } 59 | 60 | - (id)initWithName:(NSString*)name data:(NSData*)data type:(XcodeSourceFileType)type 61 | { 62 | self = [super init]; 63 | if (self) 64 | { 65 | _sourceFileName = [name copy]; 66 | _data = [data copy]; 67 | _type = type; 68 | } 69 | return self; 70 | 71 | } 72 | 73 | - (id)initWithName:(NSString*)name type:(XcodeSourceFileType)type 74 | { 75 | self = [super init]; 76 | if (self) 77 | { 78 | _sourceFileName = [name copy]; 79 | _type = type; 80 | } 81 | return self; 82 | } 83 | 84 | 85 | @end -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /FastStub/Categories/NSFileManager+Headers.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSFileManager+Headers.m 3 | // PropertyParser 4 | // 5 | // Created by marko.hlebar on 7/20/13. 6 | // Copyright (c) 2013 Clover Studio. All rights reserved. 7 | // 8 | 9 | #import "NSFileManager+Headers.h" 10 | 11 | @implementation NSFileManager (Headers) 12 | ///finds all files with extension in directory and its subdirectories 13 | ///@param extension extension of file ie @"h" 14 | ///@param path directory path 15 | ///@return array of headers 16 | +(NSArray*) findFilesWithExtension:(NSString*) extension inDirectory:(NSString*) path { 17 | return [NSFileManager findFilesWithExtensions:@[extension] inDirectory:path]; 18 | } 19 | 20 | ///finds all files with extensions in directory and its subdirectories 21 | ///@param extensions array of extensions of file ie @[@"h, @"m"] 22 | ///@param path directory path 23 | ///@return array of headers 24 | +(NSArray*) findFilesWithExtensions:(NSArray*) extensions inDirectory:(NSString*) path { 25 | NSFileManager *fileManager = [NSFileManager defaultManager]; 26 | 27 | NSError *error = nil; 28 | NSMutableArray *items = [NSMutableArray arrayWithArray:[fileManager subpathsOfDirectoryAtPath:path error:&error]]; 29 | NSMutableArray *files = [NSMutableArray array]; 30 | if (!error) { 31 | [items addObjectsFromArray:[fileManager subpathsAtPath:path]]; 32 | 33 | for (NSString *item in items) { 34 | 35 | for (NSString *extension in extensions) { 36 | if ([[item pathExtension] isEqualToString:extension]) { 37 | NSString *fullPath = [path stringByAppendingPathComponent:item]; 38 | if (![files containsObject:fullPath]) { 39 | [files addObject:fullPath]; 40 | } 41 | } 42 | } 43 | } 44 | } 45 | else { 46 | NSLog(@"%@ %@", path, [error localizedDescription]); 47 | } 48 | 49 | return [files copy]; 50 | } 51 | 52 | ///finds all subdirectories inside a directory 53 | ///@param directory directory to find subdirectories for 54 | ///@return subdirectories 55 | +(NSArray*) subDirectoriesInDirectory:(NSString*) directoryPath { 56 | NSFileManager *fileManager = [NSFileManager defaultManager]; 57 | NSError *error = nil; 58 | NSArray *items = [fileManager subpathsOfDirectoryAtPath:directoryPath error:&error]; 59 | 60 | NSMutableArray *directories = [NSMutableArray array]; 61 | 62 | for (NSString *item in items) { 63 | NSString * fullPath = [directoryPath stringByAppendingPathComponent:item]; 64 | BOOL isDir; 65 | if ([fileManager fileExistsAtPath:fullPath isDirectory:&isDir] && isDir) { 66 | [directories addObject: fullPath]; 67 | } 68 | } 69 | 70 | return [directories copy]; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Categories/NSString+XCAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+XCAdditions.m 3 | // xcode-editor 4 | // 5 | // Created by Marko Hlebar on 08/05/2014. 6 | // Copyright (c) 2014 EXPANZ. All rights reserved. 7 | // 8 | 9 | #import "NSString+XCAdditions.h" 10 | 11 | @implementation NSString (XCAdditions) 12 | - (NSString *)stringByReplacingOccurrencesOfStrings:(NSArray *)targets 13 | withString:(NSString *)replacement { 14 | __block NSString *string = self; 15 | [targets enumerateObjectsUsingBlock:^(NSString *target, NSUInteger idx, BOOL *stop) { 16 | string = [string stringByReplacingOccurrencesOfString:target withString:replacement]; 17 | }]; 18 | return string; 19 | } 20 | 21 | - (BOOL)containsOccurencesOfStrings:(NSArray *)strings { 22 | for (NSString *string in strings) { 23 | if ([self mh_containsString:string]) { 24 | return YES; 25 | } 26 | } 27 | return NO; 28 | } 29 | 30 | - (BOOL)mh_containsString:(NSString *)string { 31 | return [self rangeOfString:string].location != NSNotFound; 32 | } 33 | 34 | @end 35 | 36 | //http://stackoverflow.com/questions/412562/execute-a-terminal-command-from-a-cocoa-app 37 | @implementation NSString (ShellExecution) 38 | 39 | - (NSString*)xcRunAsCommand { 40 | NSPipe* pipe = [NSPipe pipe]; 41 | 42 | NSTask* task = [[NSTask alloc] init]; 43 | [task setLaunchPath: @"/bin/sh"]; 44 | [task setArguments:@[@"-c", [NSString stringWithFormat:@"%@", self]]]; 45 | [task setStandardOutput:pipe]; 46 | [task launch]; 47 | 48 | NSFileHandle* file = [pipe fileHandleForReading]; 49 | return [[NSString alloc] initWithData:[file readDataToEndOfFile] encoding:NSUTF8StringEncoding]; 50 | } 51 | 52 | @end 53 | 54 | @implementation NSString (ParseXCSettings) 55 | - (NSDictionary*)xcSettingsDictionary { 56 | NSArray *settingsArray = [self componentsSeparatedByString:@"\n"]; 57 | // NSLog(@"%@", settingsArray); 58 | NSCharacterSet *whitespaceSet = [NSCharacterSet whitespaceCharacterSet]; 59 | NSMutableDictionary *settingsDictionary = [NSMutableDictionary dictionary]; 60 | [settingsArray enumerateObjectsUsingBlock:^(NSString *keyValuePair, NSUInteger idx, BOOL *stop) { 61 | NSArray *keyValueArray = [keyValuePair componentsSeparatedByString:@" = "]; 62 | if (keyValueArray.count == 2) { 63 | NSString *key = [keyValueArray[0] stringByTrimmingCharactersInSet:whitespaceSet]; 64 | [settingsDictionary setObject:keyValueArray[1] 65 | forKey:key]; 66 | } 67 | }]; 68 | return settingsDictionary.copy; 69 | } 70 | 71 | - (id)xcParseWhitespaceArray { 72 | //if string doesn't contain whitespaces it is not an array of options 73 | if(![self mh_containsString:@" "]) return self; 74 | NSString *trimmedString = [self stringByReplacingOccurrencesOfString:@"\"" withString:@""]; 75 | return [trimmedString componentsSeparatedByString:@" "]; 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XCClassDefinition.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 - 2013 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | 15 | 16 | #import "XCClassDefinition.h" 17 | 18 | @implementation XCClassDefinition 19 | 20 | 21 | @synthesize className = _className; 22 | @synthesize header = _header; 23 | @synthesize source = _source; 24 | 25 | /* ====================================================================================================================================== */ 26 | #pragma mark - Class Methods 27 | 28 | + (XCClassDefinition*)classDefinitionWithName:(NSString*)fileName 29 | { 30 | return [[XCClassDefinition alloc] initWithName:fileName]; 31 | } 32 | 33 | + (XCClassDefinition*)classDefinitionWithName:(NSString*)className language:(ClassDefinitionLanguage)language 34 | { 35 | return [[XCClassDefinition alloc] initWithName:className language:language]; 36 | } 37 | 38 | /* ====================================================================================================================================== */ 39 | #pragma mark - Initialization & Destruction 40 | 41 | - (id)initWithName:(NSString*)className 42 | { 43 | return [self initWithName:className language:ObjectiveC]; 44 | } 45 | 46 | - (id)initWithName:(NSString*)className language:(ClassDefinitionLanguage)language 47 | { 48 | self = [super init]; 49 | if (self) 50 | { 51 | _className = [className copy]; 52 | if (!(language == ObjectiveC || language == ObjectiveCPlusPlus || language == CPlusPlus)) 53 | { 54 | [NSException raise:NSInvalidArgumentException format:@"Language must be one of ObjectiveC, ObjectiveCPlusPlus"]; 55 | } 56 | _language = language; 57 | } 58 | return self; 59 | } 60 | 61 | 62 | /* ====================================================================================================================================== */ 63 | #pragma mark - Interface Methods 64 | 65 | - (BOOL)isObjectiveC 66 | { 67 | return _language == ObjectiveC; 68 | } 69 | 70 | - (BOOL)isObjectiveCPlusPlus 71 | { 72 | return _language == ObjectiveCPlusPlus; 73 | } 74 | 75 | - (BOOL)isCPlusPlus 76 | { 77 | return _language == CPlusPlus; 78 | } 79 | 80 | - (NSString*)headerFileName 81 | { 82 | return [_className stringByAppendingString:@".h"]; 83 | 84 | } 85 | 86 | - (NSString*)sourceFileName 87 | { 88 | NSString* sourceFileName = nil; 89 | if ([self isObjectiveC]) 90 | { 91 | sourceFileName = [_className stringByAppendingString:@".m"]; 92 | } 93 | else if ([self isObjectiveCPlusPlus]) 94 | { 95 | sourceFileName = [_className stringByAppendingString:@".mm"]; 96 | } 97 | else if ([self isCPlusPlus]) 98 | { 99 | sourceFileName = [_className stringByAppendingString:@".cpp"]; 100 | } 101 | return sourceFileName; 102 | } 103 | 104 | 105 | @end -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XCClassDefinition.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 - 2013 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | 15 | 16 | #import "XCClassDefinition.h" 17 | 18 | @implementation XCClassDefinition 19 | 20 | 21 | @synthesize className = _className; 22 | @synthesize header = _header; 23 | @synthesize source = _source; 24 | 25 | /* ====================================================================================================================================== */ 26 | #pragma mark - Class Methods 27 | 28 | + (XCClassDefinition*)classDefinitionWithName:(NSString*)fileName 29 | { 30 | return [[XCClassDefinition alloc] initWithName:fileName]; 31 | } 32 | 33 | + (XCClassDefinition*)classDefinitionWithName:(NSString*)className language:(ClassDefinitionLanguage)language 34 | { 35 | return [[XCClassDefinition alloc] initWithName:className language:language]; 36 | } 37 | 38 | /* ====================================================================================================================================== */ 39 | #pragma mark - Initialization & Destruction 40 | 41 | - (id)initWithName:(NSString*)className 42 | { 43 | return [self initWithName:className language:ObjectiveC]; 44 | } 45 | 46 | - (id)initWithName:(NSString*)className language:(ClassDefinitionLanguage)language 47 | { 48 | self = [super init]; 49 | if (self) 50 | { 51 | _className = [className copy]; 52 | if (!(language == ObjectiveC || language == ObjectiveCPlusPlus || language == CPlusPlus)) 53 | { 54 | [NSException raise:NSInvalidArgumentException format:@"Language must be one of ObjectiveC, ObjectiveCPlusPlus"]; 55 | } 56 | _language = language; 57 | } 58 | return self; 59 | } 60 | 61 | 62 | /* ====================================================================================================================================== */ 63 | #pragma mark - Interface Methods 64 | 65 | - (BOOL)isObjectiveC 66 | { 67 | return _language == ObjectiveC; 68 | } 69 | 70 | - (BOOL)isObjectiveCPlusPlus 71 | { 72 | return _language == ObjectiveCPlusPlus; 73 | } 74 | 75 | - (BOOL)isCPlusPlus 76 | { 77 | return _language == CPlusPlus; 78 | } 79 | 80 | - (NSString*)headerFileName 81 | { 82 | return [_className stringByAppendingString:@".h"]; 83 | 84 | } 85 | 86 | - (NSString*)sourceFileName 87 | { 88 | NSString* sourceFileName = nil; 89 | if ([self isObjectiveC]) 90 | { 91 | sourceFileName = [_className stringByAppendingString:@".m"]; 92 | } 93 | else if ([self isObjectiveCPlusPlus]) 94 | { 95 | sourceFileName = [_className stringByAppendingString:@".mm"]; 96 | } 97 | else if ([self isCPlusPlus]) 98 | { 99 | sourceFileName = [_className stringByAppendingString:@".cpp"]; 100 | } 101 | return sourceFileName; 102 | } 103 | 104 | 105 | @end -------------------------------------------------------------------------------- /Pods/XcodeEditor/Source/XcodeSourceFileType.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import "XcodeSourceFileType.h" 15 | 16 | static NSDictionary* NSDictionaryWithXCFileReferenceTypes() 17 | { 18 | static NSDictionary* dictionary; 19 | static dispatch_once_t onceToken; 20 | dispatch_once(&onceToken, ^ 21 | { 22 | dictionary = @{ 23 | @"sourcecode.c.h" : @(SourceCodeHeader), 24 | @"sourcecode.c.objc" : @(SourceCodeObjC), 25 | @"wrapper.framework" : @(Framework), 26 | @"text.plist.strings" : @(PropertyList), 27 | @"sourcecode.cpp.objcpp" : @(SourceCodeObjCPlusPlus), 28 | @"sourcecode.cpp.cpp" : @(SourceCodeCPlusPlus), 29 | @"file.xib" : @(XibFile), 30 | @"image.png" : @(ImageResourcePNG), 31 | @"wrapper.cfbundle" : @(Bundle), 32 | @"archive.ar" : @(Archive), 33 | @"text.html" : @(HTML), 34 | @"text" : @(TEXT), 35 | @"wrapper.pb-project" : @(XcodeProject), 36 | @"folder" : @(Folder), 37 | @"folder.assetcatalog" : @(AssetCatalog), 38 | @"sourcecode.swift" : @(SourceCodeSwift), 39 | @"wrapper.application" : @(Application), 40 | @"file.playground" : @(Playground), 41 | @"text.script.sh" : @(ShellScript), 42 | @"net.daringfireball.markdown" : @(Markdown), 43 | @"text.plist.xml" : @(XMLPropertyList), 44 | @"file.storyboard" : @(Storyboard), 45 | @"text.xcconfig" : @(XCConfig) 46 | }; 47 | }); 48 | 49 | return dictionary; 50 | } 51 | 52 | NSString* NSStringFromXCSourceFileType(XcodeSourceFileType type) 53 | { 54 | return [[NSDictionaryWithXCFileReferenceTypes() allKeysForObject:@(type)] objectAtIndex:0]; 55 | } 56 | 57 | XcodeSourceFileType XCSourceFileTypeFromStringRepresentation(NSString* string) 58 | { 59 | NSDictionary* typeStrings = NSDictionaryWithXCFileReferenceTypes(); 60 | 61 | if (typeStrings[string]) 62 | { 63 | return (XcodeSourceFileType) [typeStrings[string] intValue]; 64 | } 65 | else 66 | { 67 | return FileTypeNil; 68 | } 69 | } 70 | 71 | 72 | XcodeSourceFileType XCSourceFileTypeFromFileName(NSString* fileName) 73 | { 74 | if ([fileName hasSuffix:@".h"] || [fileName hasSuffix:@".hh"] || [fileName hasSuffix:@".hpp"] || [fileName hasSuffix:@".hxx"]) 75 | { 76 | return SourceCodeHeader; 77 | } 78 | if ([fileName hasSuffix:@".c"] || [fileName hasSuffix:@".m"]) 79 | { 80 | return SourceCodeObjC; 81 | } 82 | if ([fileName hasSuffix:@".mm"]) 83 | { 84 | return SourceCodeObjCPlusPlus; 85 | } 86 | if ([fileName hasSuffix:@".cpp"]) 87 | { 88 | return SourceCodeCPlusPlus; 89 | } 90 | if ([fileName hasSuffix:@".swift"]) 91 | { 92 | return SourceCodeSwift; 93 | } 94 | return FileTypeNil; 95 | } 96 | 97 | -------------------------------------------------------------------------------- /FastStub/FSIDENotificationHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSIDENotificationHandler.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/16. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSIDENotificationHandler.h" 10 | #import "XCFXcodePrivate.h" 11 | #import "FastStubInspector.h" 12 | 13 | @implementation FSIDENotificationHandler 14 | 15 | + (instancetype)sharedInstance 16 | { 17 | static FSIDENotificationHandler* instance = nil; 18 | 19 | static dispatch_once_t onceToken; 20 | dispatch_once(&onceToken, ^{ 21 | instance = [FSIDENotificationHandler new]; 22 | }); 23 | 24 | return instance; 25 | } 26 | 27 | - (instancetype)init 28 | { 29 | self = [super init]; 30 | if (self) { 31 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 32 | 33 | [notificationCenter addObserver:self 34 | selector:@selector(projectDidOpen:) 35 | name:@"PBXProjectDidOpenNotification" 36 | object:nil]; 37 | 38 | [notificationCenter addObserver:self 39 | selector:@selector(projectDidChange:) 40 | name:@"PBXProjectDidChangeNotification" 41 | object:nil]; 42 | 43 | [notificationCenter addObserver:self 44 | selector:@selector(fileDidSave:) 45 | name:@"IDEEditorDocumentDidSaveNotification" 46 | object:nil]; 47 | } 48 | return self; 49 | } 50 | 51 | - (void)fileDidSave:(NSNotification *)notification { 52 | NSString *path = [[[notification object] fileURL] path]; 53 | if ([path hasSuffix:@".h"]) { 54 | [[FastStubInspector sharedInstance] updateHeader:path]; 55 | } 56 | } 57 | 58 | - (void)projectDidOpen:(NSNotification *)notification { 59 | [self projectDidChange:notification]; 60 | 61 | [[FastStubInspector sharedInstance] loadCustomElement]; 62 | } 63 | 64 | - (void)projectDidChange:(NSNotification *)notification { 65 | NSString *filePath = [self filePathForProjectFromNotification:notification]; 66 | 67 | //build cache, avoid parsing the same project more than once 68 | static NSMutableDictionary* parseMap = nil; 69 | if (parseMap == nil) { 70 | parseMap = @{}.mutableCopy; 71 | } 72 | // if ([parseMap objectForKey:filePath]) { 73 | // return; 74 | // } 75 | // [parseMap setObject:filePath forKey:filePath]; 76 | 77 | if (filePath) { 78 | [[FastStubInspector sharedInstance] updateProject:filePath completeBlock:nil]; 79 | } 80 | } 81 | 82 | #pragma clang diagnostic push 83 | #pragma clang diagnostic ignored "-Wundeclared-selector" 84 | 85 | - (NSString *)filePathForProjectFromNotification:(NSNotification *)notification { 86 | if ([notification.object respondsToSelector:@selector(projectFilePath)]) { 87 | NSString *pbxProjPath = [notification.object performSelector:@selector(projectFilePath)]; 88 | return [pbxProjPath stringByDeletingLastPathComponent]; 89 | } 90 | return nil; 91 | } 92 | 93 | #pragma clang diagnostic pop 94 | 95 | - (void)dealloc 96 | { 97 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 98 | } 99 | 100 | 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/Source/XcodeSourceFileType.m: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // JASPER BLUES 4 | // Copyright 2012 Jasper Blues 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Jasper Blues permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | 14 | #import "XcodeSourceFileType.h" 15 | 16 | static NSDictionary* NSDictionaryWithXCFileReferenceTypes() 17 | { 18 | static NSDictionary* dictionary; 19 | static dispatch_once_t onceToken; 20 | dispatch_once(&onceToken, ^ 21 | { 22 | dictionary = @{ 23 | @"sourcecode.c.h" : @(SourceCodeHeader), 24 | @"sourcecode.c.objc" : @(SourceCodeObjC), 25 | @"wrapper.framework" : @(Framework), 26 | @"text.plist.strings" : @(PropertyList), 27 | @"sourcecode.cpp.objcpp" : @(SourceCodeObjCPlusPlus), 28 | @"sourcecode.cpp.cpp" : @(SourceCodeCPlusPlus), 29 | @"file.xib" : @(XibFile), 30 | @"image.png" : @(ImageResourcePNG), 31 | @"wrapper.cfbundle" : @(Bundle), 32 | @"archive.ar" : @(Archive), 33 | @"text.html" : @(HTML), 34 | @"text" : @(TEXT), 35 | @"wrapper.pb-project" : @(XcodeProject), 36 | @"folder" : @(Folder), 37 | @"folder.assetcatalog" : @(AssetCatalog), 38 | @"sourcecode.swift" : @(SourceCodeSwift), 39 | @"wrapper.application" : @(Application), 40 | @"file.playground" : @(Playground), 41 | @"text.script.sh" : @(ShellScript), 42 | @"net.daringfireball.markdown" : @(Markdown), 43 | @"text.plist.xml" : @(XMLPropertyList), 44 | @"file.storyboard" : @(Storyboard), 45 | @"text.xcconfig" : @(XCConfig) 46 | }; 47 | }); 48 | 49 | return dictionary; 50 | } 51 | 52 | NSString* NSStringFromXCSourceFileType(XcodeSourceFileType type) 53 | { 54 | return [[NSDictionaryWithXCFileReferenceTypes() allKeysForObject:@(type)] objectAtIndex:0]; 55 | } 56 | 57 | XcodeSourceFileType XCSourceFileTypeFromStringRepresentation(NSString* string) 58 | { 59 | NSDictionary* typeStrings = NSDictionaryWithXCFileReferenceTypes(); 60 | 61 | if (typeStrings[string]) 62 | { 63 | return (XcodeSourceFileType) [typeStrings[string] intValue]; 64 | } 65 | else 66 | { 67 | return FileTypeNil; 68 | } 69 | } 70 | 71 | 72 | XcodeSourceFileType XCSourceFileTypeFromFileName(NSString* fileName) 73 | { 74 | if ([fileName hasSuffix:@".h"] || [fileName hasSuffix:@".hh"] || [fileName hasSuffix:@".hpp"] || [fileName hasSuffix:@".hxx"]) 75 | { 76 | return SourceCodeHeader; 77 | } 78 | if ([fileName hasSuffix:@".c"] || [fileName hasSuffix:@".m"]) 79 | { 80 | return SourceCodeObjC; 81 | } 82 | if ([fileName hasSuffix:@".mm"]) 83 | { 84 | return SourceCodeObjCPlusPlus; 85 | } 86 | if ([fileName hasSuffix:@".cpp"]) 87 | { 88 | return SourceCodeCPlusPlus; 89 | } 90 | if ([fileName hasSuffix:@".swift"]) 91 | { 92 | return SourceCodeSwift; 93 | } 94 | return FileTypeNil; 95 | } 96 | 97 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | -------------------------------------------------------------------------------- /FastStub.xcodeproj/xcshareddata/xcschemes/FastStub.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | 61 | 65 | 66 | 67 | 73 | 74 | 75 | 76 | 77 | 78 | 84 | 85 | 87 | 88 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /FastStub/External/XcodeEditor/XCWorkspace.m: -------------------------------------------------------------------------------- 1 | // 2 | // XCWorkspace.m 3 | // xcode-editor 4 | // 5 | // Created by Marko Hlebar on 06/05/2014. 6 | // Copyright (c) 2014 EXPANZ. All rights reserved. 7 | // 8 | 9 | #import "XCWorkspace.h" 10 | #import "XCProject.h" 11 | #import "NSString+XCAdditions.h" 12 | #import "XCProject+Extensions.h" 13 | #import "XCSourceFile.h" 14 | 15 | NSString * const XCWorkspaceProjectWorkspaceFile = @"project.xcworkspace"; 16 | 17 | static NSString * const XCWorkspaceContents = @"contents.xcworkspacedata"; 18 | static NSString * const XCFileRefElement = @"FileRef"; 19 | static NSString * const XCLocationKey = @"location"; 20 | 21 | @interface XCWorkspace () 22 | 23 | @end 24 | 25 | @implementation XCWorkspace 26 | { 27 | NSXMLParser *_parser; 28 | } 29 | 30 | + (instancetype)workspaceWithFilePath:(NSString*)filePath 31 | { 32 | return [[self alloc] initWithFilePath:filePath]; 33 | } 34 | 35 | - (instancetype)initWithFilePath:(NSString*)filePath 36 | { 37 | self = [super init]; 38 | if (self) 39 | { 40 | _filePath = filePath.copy; 41 | 42 | [self parseWorkspaceWithFilePath:_filePath]; 43 | } 44 | return self; 45 | } 46 | 47 | - (void)parseWorkspaceWithFilePath:(NSString *)filePath 48 | { 49 | _projects = [NSArray new]; 50 | 51 | filePath = [filePath stringByAppendingPathComponent:XCWorkspaceContents]; 52 | NSURL *url = [NSURL fileURLWithPath:filePath]; 53 | 54 | _parser = [[NSXMLParser alloc] initWithContentsOfURL:url]; 55 | _parser.delegate = self; 56 | [_parser parse]; 57 | } 58 | 59 | - (void) addProjectWithFilePath:(NSString *)filePath { 60 | if(![[NSFileManager defaultManager] fileExistsAtPath:filePath]) return; 61 | 62 | XCProject *project = [XCProject projectWithFilePath:filePath]; 63 | _projects = [_projects arrayByAddingObject:project]; 64 | 65 | //subprojects 66 | NSArray *subProjects = [project subProjectFiles]; 67 | if (subProjects.count > 0) { 68 | NSString *rootPath = [filePath stringByDeletingLastPathComponent]; 69 | [subProjects enumerateObjectsUsingBlock:^(XCSourceFile *projectFile, NSUInteger idx, BOOL *stop) { 70 | NSString *fullPath = [rootPath stringByAppendingPathComponent:projectFile.pathRelativeToProjectRoot]; 71 | [self addProjectWithFilePath:fullPath]; 72 | }]; 73 | } 74 | } 75 | 76 | - (void)parser:(NSXMLParser *)parser 77 | didStartElement:(NSString *)elementName 78 | namespaceURI:(NSString *)namespaceURI 79 | qualifiedName:(NSString *)qName 80 | attributes:(NSDictionary *)attributeDict 81 | { 82 | if ([elementName isEqualToString:XCFileRefElement]) { 83 | NSString *location = attributeDict[XCLocationKey]; 84 | 85 | if ([location mh_containsString:@"self:"]) { 86 | location = [self workspaceRootPath]; 87 | } 88 | else { 89 | NSArray *stringsToReplace = @[@"group:", @"container:"]; 90 | location = [location stringByReplacingOccurrencesOfStrings:stringsToReplace 91 | withString:@""]; 92 | location = [[self workspaceRootPath] stringByAppendingPathComponent:location]; 93 | } 94 | 95 | [self addProjectWithFilePath:location]; 96 | } 97 | } 98 | 99 | - (NSString *)workspaceRootPath 100 | { 101 | return [_filePath stringByDeletingLastPathComponent]; 102 | } 103 | 104 | - (void) parserDidEndDocument:(NSXMLParser *)parser 105 | { 106 | _parser = nil; 107 | } 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /FastStub/Categories/NSString+PDRegex/NSString+PDRegex.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+PDRegex.m 3 | // RegexOnNSString 4 | // 5 | // Created by Carl Brown on 10/3/11. 6 | // Copyright 2011 PDAgent, LLC. Released under MIT License. 7 | // 8 | 9 | #import "NSString+PDRegex.h" 10 | 11 | @implementation NSString (PDRegex) 12 | 13 | -(NSString *) vv_stringByReplacingRegexPattern:(NSString *)regex withString:(NSString *) replacement caseInsensitive:(BOOL)ignoreCase { 14 | return [self vv_stringByReplacingRegexPattern:regex withString:replacement caseInsensitive:ignoreCase treatAsOneLine:NO]; 15 | } 16 | 17 | -(NSString *) vv_stringByReplacingRegexPattern:(NSString *)regex withString:(NSString *) replacement caseInsensitive:(BOOL) ignoreCase treatAsOneLine:(BOOL) assumeMultiLine { 18 | 19 | NSUInteger options=0; 20 | if (ignoreCase) { 21 | options = options | NSRegularExpressionCaseInsensitive; 22 | } 23 | if (assumeMultiLine) { 24 | options = options | NSRegularExpressionDotMatchesLineSeparators; 25 | } 26 | 27 | NSError *error=nil; 28 | NSRegularExpression *pattern = [NSRegularExpression regularExpressionWithPattern:regex options:options error:&error]; 29 | if (error) { 30 | NSLog(@"Error creating Regex: %@",[error description]); 31 | return nil; 32 | } 33 | 34 | NSString *retVal= [pattern stringByReplacingMatchesInString:self options:0 range:NSMakeRange(0, [self length]) withTemplate:replacement]; 35 | return retVal; 36 | } 37 | 38 | -(NSString *) vv_stringByReplacingRegexPattern:(NSString *)regex withString:(NSString *) replacement { 39 | return [self vv_stringByReplacingRegexPattern:regex withString:replacement caseInsensitive:NO treatAsOneLine:NO]; 40 | } 41 | 42 | -(NSArray *) vv_stringsByExtractingGroupsUsingRegexPattern:(NSString *)regex caseInsensitive:(BOOL) ignoreCase treatAsOneLine:(BOOL) assumeMultiLine { 43 | NSUInteger options=0; 44 | if (ignoreCase) { 45 | options = options | NSRegularExpressionCaseInsensitive; 46 | } 47 | if (assumeMultiLine) { 48 | options = options | NSRegularExpressionDotMatchesLineSeparators; 49 | } 50 | 51 | NSError *error=nil; 52 | NSRegularExpression *pattern = [NSRegularExpression regularExpressionWithPattern:regex options:options error:&error]; 53 | if (error) { 54 | NSLog(@"Error creating Regex: %@",[error description]); 55 | return nil; 56 | } 57 | 58 | __block NSMutableArray *retVal = [NSMutableArray array]; 59 | [pattern enumerateMatchesInString:self options:0 range:NSMakeRange(0, [self length]) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) { 60 | //Note, we only want to return the things in parens, so we're skipping index 0 intentionally 61 | for (int i=1; i<[result numberOfRanges]; i++) { 62 | NSString *matchedString=[self substringWithRange:[result rangeAtIndex:i]]; 63 | [retVal addObject:matchedString]; 64 | } 65 | }]; 66 | return retVal; 67 | } 68 | 69 | -(NSArray *) vv_stringsByExtractingGroupsUsingRegexPattern:(NSString *)regex { 70 | return [self vv_stringsByExtractingGroupsUsingRegexPattern:regex caseInsensitive:NO treatAsOneLine:NO]; 71 | } 72 | 73 | -(BOOL) vv_matchesPatternRegexPattern:(NSString *)regex caseInsensitive:(BOOL) ignoreCase treatAsOneLine:(BOOL) assumeMultiLine { 74 | NSUInteger options=0; 75 | if (ignoreCase) { 76 | options = options | NSRegularExpressionCaseInsensitive; 77 | } 78 | if (assumeMultiLine) { 79 | options = options | NSRegularExpressionDotMatchesLineSeparators; 80 | } 81 | 82 | NSError *error=nil; 83 | NSRegularExpression *pattern = [NSRegularExpression regularExpressionWithPattern:regex options:options error:&error]; 84 | if (error) { 85 | NSLog(@"Error creating Regex: %@",[error description]); 86 | return NO; //Can't possibly match an invalid Regex 87 | } 88 | 89 | return ([pattern numberOfMatchesInString:self options:0 range:NSMakeRange(0, [self length])] > 0); 90 | } 91 | 92 | -(BOOL) vv_matchesPatternRegexPattern:(NSString *)regex { 93 | return [self vv_matchesPatternRegexPattern:regex caseInsensitive:NO treatAsOneLine:NO]; 94 | } 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /FastStub/External/Benoit/XCFXcodePrivate.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Benoît on 11/01/14. 3 | // Copyright (c) 2014 Pragmatic Code. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | @interface DVTTextDocumentLocation : NSObject 9 | @property (readonly) NSRange characterRange; 10 | @property (readonly) NSRange lineRange; 11 | @property (readonly) NSURL *documentURL; 12 | @end 13 | 14 | @interface DVTTextPreferences : NSObject 15 | + (id)preferences; 16 | @property BOOL trimWhitespaceOnlyLines; 17 | @property BOOL trimTrailingWhitespace; 18 | @property BOOL useSyntaxAwareIndenting; 19 | @end 20 | 21 | @interface DVTSourceTextStorage : NSTextStorage 22 | - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)string withUndoManager:(id)undoManager; 23 | - (NSRange)lineRangeForCharacterRange:(NSRange)range; 24 | - (NSRange)characterRangeForLineRange:(NSRange)range; 25 | - (void)indentCharacterRange:(NSRange)range undoManager:(id)undoManager; 26 | @end 27 | 28 | @interface DVTFileDataType : NSObject 29 | @property (readonly) NSString *identifier; 30 | @end 31 | 32 | @interface DVTFilePath : NSObject 33 | @property (readonly) NSURL *fileURL; 34 | @property (readonly) DVTFileDataType *fileDataTypePresumed; 35 | @end 36 | 37 | @interface IDEContainerItem : NSObject 38 | @property (readonly) DVTFilePath *resolvedFilePath; 39 | @end 40 | 41 | @interface IDEGroup : IDEContainerItem 42 | 43 | @end 44 | 45 | @interface IDEFileReference : IDEContainerItem 46 | 47 | @end 48 | 49 | @interface IDENavigableItem : NSObject 50 | @property (readonly) IDENavigableItem *parentItem; 51 | @property (readonly) NSArray *childItems; 52 | @property (readonly) id representedObject; 53 | @end 54 | 55 | @interface IDEFileNavigableItem : IDENavigableItem 56 | @property (readonly) DVTFileDataType *documentType; 57 | @property (readonly) NSURL *fileURL; 58 | @end 59 | 60 | @interface IDEGroupNavigableItem : IDENavigableItem 61 | @property (readonly) IDEGroup *group; 62 | @end 63 | 64 | @interface IDEStructureNavigator : NSObject 65 | @property (retain) NSArray *selectedObjects; 66 | @end 67 | 68 | @interface IDENavigableItemCoordinator : NSObject 69 | - (id)structureNavigableItemForDocumentURL:(id)arg1 inWorkspace:(id)arg2 error:(id *)arg3; 70 | @end 71 | 72 | @interface IDENavigatorArea : NSObject 73 | - (id)currentNavigator; 74 | @end 75 | 76 | @interface IDEWorkspaceTabController : NSObject 77 | @property (readonly) IDENavigatorArea *navigatorArea; 78 | @end 79 | 80 | @interface IDEDocumentController : NSDocumentController 81 | + (id)editorDocumentForNavigableItem:(id)arg1; 82 | + (id)retainedEditorDocumentForNavigableItem:(id)arg1 error:(id *)arg2; 83 | + (void)releaseEditorDocument:(id)arg1; 84 | @end 85 | 86 | @interface IDESourceCodeDocument : NSDocument 87 | - (DVTSourceTextStorage *)textStorage; 88 | - (NSUndoManager *)undoManager; 89 | @end 90 | 91 | @interface IDESourceCodeComparisonEditor : NSObject 92 | @property (readonly) NSTextView *keyTextView; 93 | @property (retain) NSDocument *primaryDocument; 94 | @end 95 | 96 | @interface IDESourceCodeEditor : NSObject 97 | @property (retain) NSTextView *textView; 98 | - (IDESourceCodeDocument *)sourceCodeDocument; 99 | @end 100 | 101 | @interface IDEEditorContext : NSObject 102 | - (id)editor; // returns the current editor. If the editor is the code editor, the class is `IDESourceCodeEditor` 103 | @end 104 | 105 | @interface IDEEditorArea : NSObject 106 | - (IDEEditorContext *)lastActiveEditorContext; 107 | @end 108 | 109 | @interface IDEWorkspaceWindowController : NSObject 110 | @property (readonly) IDEWorkspaceTabController *activeWorkspaceTabController; 111 | - (IDEEditorArea *)editorArea; 112 | @end 113 | 114 | @interface IDEWorkspace : NSObject 115 | @property (readonly) DVTFilePath *representingFilePath; 116 | @end 117 | 118 | @interface IDEWorkspaceDocument : NSDocument 119 | @property (readonly) IDEWorkspace *workspace; 120 | @end 121 | 122 | typedef NS_ENUM(NSInteger, IDEIssueSeverity) { 123 | IDEIssueSeverityNone = 0, 124 | IDEIssueSeverityWarning = 1, 125 | IDEIssueSeverityError = 2 126 | }; 127 | 128 | @interface IDEIssue : NSObject 129 | @property (readonly) NSArray *documentLocations; 130 | @property (readonly) IDEIssueSeverity severity; 131 | @property (readonly) NSString *fullMessage; 132 | @property (readonly) NSString *issueTypeIdentifier; 133 | @end -------------------------------------------------------------------------------- /FastStub/SuggestionStubController/FSSuggestionStubController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSSuggestionStubController.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/18. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSSuggestionStubController.h" 10 | #import "FSSuggestionStubView.h" 11 | #import "FSSuggestionCellModel.h" 12 | 13 | @interface FSSuggestionStubController () 14 | 15 | @property (nonatomic, strong) NSMutableArray* items; 16 | @property (nonatomic, strong) FSSuggestionStubView* stubView; 17 | 18 | 19 | @end 20 | 21 | @implementation FSSuggestionStubController 22 | 23 | + (instancetype)sharedInstance 24 | { 25 | static FSSuggestionStubController* instance = nil; 26 | 27 | static dispatch_once_t onceToken; 28 | dispatch_once(&onceToken, ^{ 29 | instance = [FSSuggestionStubController new]; 30 | }); 31 | 32 | return instance; 33 | } 34 | 35 | - (instancetype)init 36 | { 37 | self = [super init]; 38 | if (self) { 39 | 40 | } 41 | return self; 42 | } 43 | 44 | - (void)configWithContentView:(NSView*)view withItems:(NSArray*)items 45 | { 46 | self.items = items.mutableCopy; 47 | _stubView = (FSSuggestionStubView*)view; 48 | 49 | //config table view 50 | _stubView.tableView.dataSource = self; 51 | _stubView.tableView.delegate = self; 52 | 53 | _stubView.tableView.target = self; 54 | _stubView.tableView.doubleAction = @selector(onItemSelected); 55 | _stubView.tableView.selectionHighlightStyle = NSTableViewSelectionHighlightStyleNone; 56 | 57 | [_stubView.tableView reloadData]; 58 | [_stubView.tableView scrollRowToVisible:0]; 59 | 60 | NSIndexSet *set = [NSIndexSet indexSetWithIndex:0]; 61 | [_stubView.tableView selectRowIndexes:set byExtendingSelection:NO]; 62 | } 63 | 64 | 65 | #pragma mark- NSTableViewDataSource 66 | - (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { 67 | [self onItemSelected]; 68 | return NO; 69 | } 70 | 71 | - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView 72 | { 73 | return _items.count; 74 | } 75 | 76 | - (nullable id)tableView:(NSTableView *)tableView objectValueForTableColumn:(nullable NSTableColumn *)tableColumn row:(NSInteger)row 77 | { 78 | if (row > _items.count-1) { 79 | return nil; 80 | } 81 | 82 | FSSuggestionStub* model = _items[row]; 83 | NSString* text = model.cellText; 84 | 85 | text = [NSString stringWithFormat:@" %@", text]; 86 | 87 | return text; 88 | } 89 | 90 | - (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { 91 | 92 | if (rowIndex > _items.count-1) { 93 | return; 94 | } 95 | 96 | // FSSuggestionStub* model = _items[rowIndex]; 97 | 98 | NSTextFieldCell *cell = aCell; 99 | [cell setTextColor:[NSColor colorWithWhite:6.0/255 alpha:1.0]]; 100 | 101 | 102 | id c = [aTableColumn dataCell]; 103 | [c setFont:[NSFont systemFontOfSize:12]]; 104 | 105 | 106 | if ([[aTableView selectedRowIndexes] containsIndex:rowIndex]) 107 | { 108 | [aCell setBackgroundColor:[NSColor colorWithRed:13.0/255 green:83.0/255 blue:209.0/255 alpha:0.8]]; 109 | [cell setTextColor:[NSColor whiteColor]]; 110 | } 111 | else 112 | { 113 | [aCell setBackgroundColor: [NSColor whiteColor]]; 114 | } 115 | [aCell setDrawsBackground:YES]; 116 | } 117 | 118 | - (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row 119 | { 120 | return 18; 121 | } 122 | 123 | - (void)onItemSelected 124 | { 125 | NSIndexSet *indexes = [_stubView.tableView selectedRowIndexes]; 126 | 127 | if ([indexes count] > 0) { 128 | 129 | NSMutableArray* items = @[].mutableCopy; 130 | [indexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) { 131 | 132 | if (idx <= _items.count -1) { 133 | [items addObject:_items[idx]]; 134 | } 135 | }]; 136 | if (_delegate != nil) { 137 | [_delegate onStubItemSelected:items]; 138 | } 139 | } 140 | } 141 | 142 | 143 | 144 | @end 145 | -------------------------------------------------------------------------------- /FastStub/FSElementPool.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSElementPool.m 3 | // FastStub 4 | // 5 | // Created by gao feng on 16/5/17. 6 | // Copyright © 2016年 music4kid. All rights reserved. 7 | // 8 | 9 | #import "FSElementPool.h" 10 | #import "XCProject.h" 11 | #import "XCSourceFile.h" 12 | #import "XCSourceFile+Path.h" 13 | 14 | #import "FSInterfaceProcessor.h" 15 | #import "FSProtocolProcessor.h" 16 | #import "FSElementCache.h" 17 | 18 | @interface FSElementPool () 19 | @property (nonatomic, strong) NSOperationQueue* parseQueue; 20 | @end 21 | 22 | @implementation FSElementPool 23 | 24 | + (instancetype)sharedInstance 25 | { 26 | static FSElementPool* instance = nil; 27 | 28 | static dispatch_once_t onceToken; 29 | dispatch_once(&onceToken, ^{ 30 | instance = [FSElementPool new]; 31 | }); 32 | 33 | return instance; 34 | } 35 | 36 | - (instancetype)init 37 | { 38 | self = [super init]; 39 | if (self) { 40 | _elementMap = @{}.mutableCopy; 41 | 42 | _parseQueue = [NSOperationQueue new]; 43 | _parseQueue.maxConcurrentOperationCount = 1; 44 | } 45 | return self; 46 | } 47 | 48 | - (FSElementCache*)getElementFromCache:(NSString*)elementName 49 | { 50 | FSElementCache* match = [_elementMap objectForKey:elementName]; 51 | return match; 52 | } 53 | - (void)parseElementFromProjectFile:(NSString*)filePath complete:(dispatch_block_t)completeBlock 54 | { 55 | XCProject *project = [XCProject projectWithFilePath:filePath]; 56 | [_parseQueue addOperationWithBlock:^{ 57 | [self parseProject:project]; 58 | [[NSOperationQueue mainQueue] addOperationWithBlock:^{ 59 | completeBlock(); 60 | }]; 61 | }]; 62 | } 63 | 64 | - (void)parseHeaderFile:(NSString*)filePath 65 | { 66 | [self processHeaderPath:filePath]; 67 | } 68 | 69 | - (void)parseProject:(XCProject *)project 70 | { 71 | NSDate *start = [NSDate date]; 72 | NSMutableSet *missingFiles = [NSMutableSet set]; 73 | for (XCSourceFile *header in project.headerFiles) { 74 | if (![self processHeaderPath:[header fullPath]]) { 75 | NSString *file = [[header pathRelativeToProjectRoot] lastPathComponent]; 76 | if (file) { 77 | [missingFiles addObject:file]; 78 | } 79 | } 80 | } 81 | 82 | NSString *projectDir = [[project filePath] stringByDeletingLastPathComponent]; 83 | NSArray *missingHeaderFullPaths = [self fullPathsForFiles:missingFiles inDirectory:projectDir]; 84 | 85 | for (NSString *headerMissingFullpath in missingHeaderFullPaths) { 86 | [self processHeaderPath:headerMissingFullpath]; 87 | } 88 | 89 | NSDate *methodFinish = [NSDate date]; 90 | NSTimeInterval executionTime = [methodFinish timeIntervalSinceDate:start]; 91 | 92 | NSLog(@"project %@ - parse time: %f", [[project filePath] lastPathComponent], executionTime); 93 | } 94 | 95 | - (BOOL)processHeaderPath:(NSString *)headerPath { 96 | @autoreleasepool { 97 | NSError *error = nil; 98 | NSString *content = [NSString stringWithContentsOfFile:headerPath encoding:NSUTF8StringEncoding error:&error]; 99 | if (error) { 100 | return NO; 101 | } 102 | 103 | NSArray *processors = @[[FSInterfaceProcessor new], [FSProtocolProcessor new]]; 104 | 105 | for (FSElementProcessor *processor in processors) { 106 | NSArray *elements = [processor createElements:content]; 107 | 108 | for (FSElementCache* ele in elements) { 109 | ele.filePath = headerPath; 110 | [_elementMap setObject:ele forKey:ele.elementName]; 111 | } 112 | } 113 | 114 | return YES; 115 | } 116 | } 117 | 118 | - (NSArray *)fullPathsForFiles:(NSSet *)fileNames inDirectory:(NSString *)directoryPath { 119 | NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtPath:directoryPath]; 120 | 121 | NSMutableArray *fullPaths = [NSMutableArray array]; 122 | 123 | NSString *filePath = nil; 124 | while ( (filePath = [enumerator nextObject] ) != nil ){ 125 | if ([fileNames containsObject:[filePath lastPathComponent]]) { 126 | [fullPaths addObject:[directoryPath stringByAppendingPathComponent:filePath]]; 127 | } 128 | } 129 | 130 | return fullPaths; 131 | } 132 | 133 | 134 | 135 | @end 136 | --------------------------------------------------------------------------------