14.7 C
Canberra
Sunday, October 26, 2025

iOS Dev Weekly – The perfect iOS growth hyperlinks, each Friday


I observed one thing whereas studying Nezhyborets Oleksii’s newest publish on formatting code throughout a number of strains. He left out a brand new Xcode function, however it caught my eye as I’ve been hoping Apple would add this for years!

New in Xcode 16’s “Editor” menu below “Construction” you’ll discover “Format File with swift-format”. 😍 I couldn’t wait to strive it, so I loaded an Xcode undertaking, opened a file, and it labored flawlessly! I don’t have swift-format put in globally on my machine, so Xcode should now bundle a model of the device. It seems that it’s now a part of the Swift 6.0 toolchain. Even higher!

Why am I so enthusiastic about this, although? We have now been capable of run this device for years.

I’m excited as a result of I care about formatting instruments like this turning into trivial to make use of, and even at some point for it to change into default to run this device each time you save a file. 😱

I wrote one thing on “Prettier” a few years in the past, and I’d urge you to re-read it earlier than you proceed. It’ll clarify why I would like this a lot, and my emotions have solely change into stronger about it since then.

Exposing swift-format in Xcode is the first step to that dream of the Swift group adopting a formatting normal. Even higher, there’s no in-built “set your formatting choices” in Xcode’s Settings that I might see. I do know it has choices for controlling what guidelines get utilized from a config file, however I hope Apple doesn’t push that customisability an excessive amount of. For my part, it might be a step ahead for Swift if we might agree on a regular format for Swift code. Sadly, getting builders to agree on that’s not possible. It can take management as an alternative, and Apple ought to present that management.

So far as I do know, there’s no method to inform Xcode to run a command each time you save a file. I checked out whether or not Behaviours might do it, however I don’t consider it will possibly. I hope Apple additionally add a simple method to carry out a command on saving a file.

So if you happen to’re studying this inside Apple, or if somebody there who may need affect on this space, please go this on. I’d even be more than pleased to speak to anybody from that workforce in the event that they wish to hear an much more passionate model of this intro! 😂 I don’t count on them to modify the “format on save” command on by default¹, however please give folks the choice.

Look to the JavaScript and Go communities to see what a hit this could possibly be. It will likely be price a couple of weeks of complaints about what the ultimate set of default guidelines ought to be, however it’ll be a real step ahead for extra readable Swift code for the remainder of time!

¹ But… 😂



Dave Verwer  

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles