Swiftify is now able to detect whether the Objective-C code was using a multi-line syntax for method declarations and method calls, and switch to the multi-line syntax accordingly. See this sample and compare the Swift 5.1 and Swift 5.2 outputs to see the difference.
The Official Ray Wenderlich Swift Style Guide says:
Keep short function declarations on one line including the opening brace:
func reticulateSplines(spline: [Double]) -> Bool {
// reticulate code goes here
}
For functions with long signatures, put each parameter on a new line and add an extra indent on subsequent lines:
func reticulateSplines(
spline: [Double],
adjustmentFactor: Double,
translateConstant: Int,
comment: String
) -> Bool {
// reticulate code goes here
}
Mirror the style of function declarations at call sites. Calls that fit on a single line should be written like this:
let success = reticulateSplines(splines)
If the call site must be wrapped, put each parameter on a new line, indented one additional level:
let success = reticulateSplines(
spline: splines,
adjustmentFactor: 1.3,
translateConstant: 2,
comment: "normalize the display")
Comments
0 comments
Please sign in to leave a comment.