SwiftCSV
SwiftCSV copied to clipboard
Enumerated Ambiguous Use
trafficstars
Xcode 14.3 is throwing Ambiguous use of 'enumerateAsArray'
with
do {
// As a string, guessing the delimiter
let csv: CSV = try CSV<Enumerated>(string: "id,name,age\n1,Alice,18")
csv.enumerateAsArray { array in
print(array.first)
}
} catch let parseError as CSVParseError {
// Catch errors from parsing invalid CSV
} catch {
// Catch errors from trying to load files
}
Ideas?
@MattTimmons
There are two enumerateAsArray calls that both have all parameters as default or optional. As a result, calling enumerateAsArray with no parameters as per the README example won't be able to determine which variant to call, as they both end up with the same signature.
My workaround was to use
try csv.enumerateAsArray(rowLimit: Int.max) { array in ...
Thanks for spotting this, folks! @dagronf @MattTimmons I'd be happy to merge a PR that addresses this public API issue in a sensible way 👍
Thanks dagronf! That workaround did it for me.