Format Functions to Multiple Lines in Xcode 15

Make you code easier to read formatting your functions to multiple lines with the option 'Format to Multiple Lines' in Xcode 15.

Francesco Leoni

2 min read


Xcode 15

Xcode 15 introduced a nice shortcut that converts functions with many parameters on a single line to a function that has any parameter on its own line.


The below function can be hard to read since all the arguments are on the same line.

To improve the readability we could move each argument on a separate line manually, but that is pretty tedious, especially if the codebase is not formatted at all.

Fortunately, now Xcode 15 has a handy formatting feature that enables us to do it automatically.

func function(with: String, many: String, parameters: [String], that: Int, can: String, beHard: String, toRead: Int) {


To format the function on multiple lines:

  1. Right-click on a parameter or select the entire function and hit right-click.
  2. Choose Refactor
  3. Then select Format to Multiple Lines

    The result is the following, a nicely formatted function with each parameter on a new line.

func function(

    with: String,

    many: String,

    parameters: [String],

    that: Int,

    can: String,

    beHard: String,

    toRead: Int

) {



This is a nice addition that can speed up the workflow.

Unfortunately there isn't a shortcut for this option and there is no possibility to add one from the settings.

But it could be really useful to be able to add one, since this is a feature that could

be used quite frequently.

If you have any question about this article, feel free to email me or tweet me @franceleonidev and share your opinion.

Thank you for reading and see you in the next article!

Share this article

Related articles

How To Take an Xcode Simulator Screenshot without Shadows

See how to take a ready to use screenshot of the Xcode Simulator embedded in the device bezel without any shadow or toolbar.

1 min read


Fix “Cycle Inside“ Error in Xcode

See how to fix the “Cycle Inside“ error in Xcode. This error happens because there is an issue with the order of scripts.

1 min read


Error “Missing file libarclite“ (Xcode 14.3)

See how to fix the “Missing file libarclite“ error in Xcode. This is due to libraries with minimum deployment target of iOS 11.

1 min read