UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Xcode: Indent compiler directives?

Forums > SwiftUI

Is there a way to have Xcode indent compiler directives inline with the rest of the code?

I find the default (no indentation) interrupts the readability of the code. I can manually indent it, but I tend to use the auto-indent feature of Xcode to clean things up quickly - wiping out anything I've done manually.

Thanks.

2      

While many of us struggle with SwiftUI's declarative, functional programming, it's a change of pace to find that @Msans is interrupted by Xcode's implementation of indentations!

Is there a way to have Xcode indent compiler directives inline with the rest of the code?
I find the default (no indentation) interrupts the readability of the code.

This is not a paid advertisement.


Sounds very much like you're looking for a source editor extension. This is from Xcode documentation:

You build extensions to the source editor in Xcode using XcodeKit.
Source editor extensions can read and modify the contents of a source file,
as well as read and modify the current text selection within the editor.

See -> Xcode Source Editor Extenstions

Keep Coding!

Please come back and keep us posted on your progress. Looking forward to seeing your extension in the App Store!

Also, it would be great if you posted a before and after code snip of what you have and what you'd like to see!

2      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.