Introducing: XCLineSplitter

XCode 8 came with the new ability for developers to build add-ons called Source Code Extensions. These extensions add functionality to your editor, similarly to the way Atom works. These are, in my opinion, quite limited and extremely awkward to implement. They are bundled as part of OS X apps, and shipped through the Mac App Store, though I personally don’t quite see the correlation. Luckily for us developers, most of these are given away for free and open-sourced, so I’ve decided to join the club and make a little tool called XCLineSplitter.

I’m a big fan of third party tools that help developers do their jobs better. One of such tools is SwiftLint, built to keep our code nice, neat and always consistent. One of the rules in SwiftLint is line length, and I find myself running into functions like the following:

func example(function: String, that: String, takes: String, many: Int, variables: () -> Void) {
// implementation

This function declaration is quite lengthy, and it’s not only functions that have this problem. We find the same problem when initializing certain objects:

let thing = SomeThing(with: lots, and: lots, of: properties, to: remember, keeping: lines, really: long)

With XCode 8, we can install XCLineSplitter, and then bind a shortcut to it and turn one line into many lines instantly. I bind XCLS to command+ctrl+shift+I since it’s close to Xcode’s current aligning function, ctrl+I:

I didn’t have very much time to spend on it, but if you’d like you can check it out, and feel free to shoot me any pull requests to make it better for everyone.


I’m currently available for work, so if have a project in mind you can contact me at

Like what you read? Give Daniel Williams a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.