EditKitPro
EditKit Pro provides a suite of tools to help you write better, cleaner, and more efficient code. Whether you need to quickly format your code, create Codable models, generate mock data, or move around in SwiftUI more efficiently, EditKit Pro has you covered.
This is an open-source Xcode Editor Extension with a variety of mini-tools for iOS / macOS Developers.
Demos of EditKit can be found on the blog post and this YouTube Video.
Features
The current version of EditKit supports the following features:
- Align around equals
- Auto
MARK
extensions - Beautify JSON
- Convert JSON to Codable
- Copy as Markdown
- Create type definition
- Format as multi-line
- Format as single-line
- Convert selection to snakecase
- Convert selection to camelcase
- Convert selection to Pascal case
- Search selection on GitHub, Google, StackOverflow
- Sort imports
- Sort lines alphabetically (ascending and descending)
- Sort lines by length
- Strip trailing whitespaces
- Wrap in
#ifdef
- Wrap in
NSLocalizedString
- SwiftUI -> Disable outer view
- SwiftUI -> Delete outer view
- SwiftUI -> Disable outer view
- SwiftUI -> Delete view
Installation
The most convenient way of installing the current release is through the App Store. Once installed, you'll need to open System Preferences -> Extensions -> Enable EditKit Pro
.
If EditKit Pro is not visible in Extensions, this may be due to multiple conflicting Xcode installations.
Alternatively, you can clone this Xcode project:
- Once downloaded, open the .xcodeproj.
- Before running, make sure to change the Team to your Personal Development Team for both the main app target and the
EditKit
extension. The extension will not appear in Xcode unless it is signed correctly. - Select the
EditKit
extension and hit Run. - You should see a debug version of Xcode appear. Pick any project or create a new one.
- Navigate to a source code file. Now, in the Editor dropdown menu, you should now see an entry for
EditKit
.
Requirements
Please make sure you only have one valid installation of Xcode on your machine and have a valid Apple Developer account as signing the extension will be required in order to run it locally.
Contributing
All contributions are welcome. Just fork the repo and make a pull request.
- In order to add new functionality to
EditKit
, create a new entry inEditorCommandIdentifier
and a assign a unqiue key for your new command. - Then, in the
EditKit
extension'sInfo.plist
, add an entry inXCSourceEditorCommandDefinitions
for your new command. - In
EditorController.swift
, add a case to thehandle
function for your new command. - Now, you implement your new functionality by creating a new
XCSourceEditorCommand
class (i.e.BeautifyJSONCommand
) or creating a class that operates on theXCSourceEditorCommandInvocation
provided by the Xcode Editor Extension (i.e.AlignAroundEqualsCommand
class AlignAroundEqualsCommand {
static func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: (Error?) -> Void) {
...
}
}
or
class BeautifyJSONCommand: NSObject, XCSourceEditorCommand {
func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: (Error?) -> Void) {
....
}
}
All files in the Third Party
folder are modified versions of the open source libraries mentioned below.
Open Source Dependencies
EditKit would not have been possible without the help and inspiration from these open source libraries:
Note: Many of their original implementations have modified to support Swift 5.7+ and to fix bugs.
Contact
If you have any questions, feel free to message me at [email protected] or on Twitter.