We have 2 places in our project where SwiftFormat fails to parse the code and therefore throws errors:
christian@MacBook-Pro-tilhrende-Christian ios-spring % swiftformat --lint .
Running SwiftFormat...
(lint mode - no files will be changed.)
Reading config file at /Users/christian/Developer/ios-spring/.swiftformat
error: Expected { on line 232 in /Users/christian/Developer/ios-spring/Modules/AppCoordinator/AppCoordinator.swift.
error: Expected { on line 65 in /Users/christian/Developer/ios-spring/Modules/Recharge/RechargeWithVoucher/Model/VoucherRechargeDataHandler.swift.
We have been able to resolve these errors, and complete parsing by restructuring the code a bit, though it's not ideal. We feel it's a bug in SwiftFormat. Or perhaps some conflicting rules.
This code causes a problem:
private func handleGenericError(_ error: Error) {
if let requestableError = error as? RequestableError,
case let .underlying(error as NSError) = requestableError, // <--- throws error about missing '{' here
error.code == NSURLErrorNotConnectedToInternet
{
print("Error handled")
} else {
showGenericError()
}
}
Please see our swift format configuration (inside folder), and an example project to reproduce the problem.
We have 2 places in our project where SwiftFormat fails to parse the code and therefore throws errors:
We have been able to resolve these errors, and complete parsing by restructuring the code a bit, though it's not ideal. We feel it's a bug in SwiftFormat. Or perhaps some conflicting rules.
This code causes a problem:
Please see our swift format configuration (inside folder), and an example project to reproduce the problem.
Let me know if I can help! SwiftFormat-Example-Project.zip