🇨🇳中文介绍
Xcode Source Editor Extension Toolset (Plugins for Xcode 8)
Xcode Source Editor Extension based tools, improve text editing experience for Xcode 8, you can extend with simple code
- Multiline Selections
- Multiple Extensions
- Extendable API
- Clipboard Text Handling (if select nothing)
- Regular Expression Matching
- Base64 Encode
- Base64 Decode
- URL Encode
- URL Decode
- MD5
- Upper Case
- Lower Case
- Escape
- Hex
- Bin
- Oct
- Dec
- Hex
- RGB
- Preview
- Translate
- Developer
- StackOverflow
- GitHub
- Dash
- Dictionary
- JSON
- Install Xcode 8
- Build & Run
- Choose Xcode to debug
- Select text
- Open Editor menu to find extensions
- You can set a shortcut (Key-Binding) for each extension
- Maybe you will like this WWDC Session
<dict>
<key>XCSourceEditorCommandClassName</key>
<string>aClassName</string>
<key>XCSourceEditorCommandIdentifier</key>
<string>test.extension</string>
<key>XCSourceEditorCommandName</key>
<string>Test Extension</string>
</dict>
// Implement your modify strategy using block (you can implement as singleton dict)
// @{ @"commandIdentifier": handlerBlock }
- (NSDictionary *)handlers {
static NSDictionary *_instance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = @{
@"test.extension": ^NSString *(NSString *text) { return text; }
};
});
return _instance;
}
// Override performCommandWithInvocation like that
- (void)performCommandWithInvocation:(XCSourceEditorCommandInvocation *)invocation completionHandler:(void (^)(NSError * _Nullable nilOrError))completionHandler {
[xTextModifier select:invocation pattern:@"regex" handler:self.handlers[invocation.commandIdentifier]];
completionHandler(nil);
}
- More strategy for xFormat
- Error handling
- Preferences panel
- JavaScript for text handling
Since Xcode 8.0 beta (8S128d) is totally unstable now, you may see nothing after you build & run this project :(
Weibo: @StackOverflowError
Twitter: @cyanapps
Email: [email protected]