SwiftMockGeneratorForXcode
SwiftMockGeneratorForXcode copied to clipboard
Indentation follows Xcode ctrl-i
Hello!
When generating mocks for functions with input parameters on different lines, would it be possible to have them auto-indent based on Xcode's default ctrl-i
shortcut? The end result would be input parameters aligned at their first character. Examples below.
Current:
var invokedFetchRetailer = false
var invokedFetchRetailerCount = 0
var invokedFetchRetailerParameters: (identifier: Int, Void)?
var invokedFetchRetailerParametersList = [(identifier: Int, Void)]()
var stubbedFetchRetailerCompletionResult: (Result<Retailer, Error>, Void)?
func fetchRetailer(for identifier: Int,
completion: @escaping ((Result<Retailer, Error>) -> Void)) {
invokedFetchRetailer = true
invokedFetchRetailerCount += 1
invokedFetchRetailerParameters = (identifier, ())
invokedFetchRetailerParametersList.append((identifier, ()))
if let result = stubbedFetchRetailerCompletionResult {
completion(result.0)
}
}
Desired:
var invokedFetchRetailer = false
var invokedFetchRetailerCount = 0
var invokedFetchRetailerParameters: (identifier: Int, Void)?
var invokedFetchRetailerParametersList = [(identifier: Int, Void)]()
var stubbedFetchRetailerCompletionResult: (Result<Retailer, Error>, Void)?
func fetchRetailer(for identifier: Int,
completion: @escaping ((Result<Retailer, Error>) -> Void)) { // <------- NOTE "completion" aligns with "for".
invokedFetchRetailer = true
invokedFetchRetailerCount += 1
invokedFetchRetailerParameters = (identifier, ())
invokedFetchRetailerParametersList.append((identifier, ()))
if let result = stubbedFetchRetailerCompletionResult {
completion(result.0)
}
}