SwiftFormat
SwiftFormat copied to clipboard
Can swiftformat align && operators in multi-line Equatable implementations like Xcode format?
Background Xcode format automatically aligns && operators in multi-line Equatable implementations for better readability:
xcode format
struct Test: Equatable {
let a: String
let b: String
let c: String
let d: String
public static func == (lhs: Test, rhs: Test) -> Bool {
lhs.a == rhs.a &&
lhs.b == rhs.b &&
lhs.c == rhs.c
}
}
However, using swiftformat --indent doesn't apply this alignment
swiftformat --indent
struct Test: Equatable {
let a: String
let b: String
let c: String
let d: String
public static func == (lhs: Test, rhs: Test) -> Bool {
lhs.a == rhs.a &&
lhs.b == rhs.b &&
lhs.c == rhs.c
}
}
Question
Is there a way to configure swiftformat to align && operators in a way that matches Xcode format? If not, are there recommended workarounds or is this a potential feature for future updates?
I have the same problem, it's really bugging us because it causes a warning on SwiftLint. So please if anyone has an idea how to fix this it would be much appreciated. Thanks
Could we get any updates here ?