The required function returns WordLocation. But there is no explanation or definition of this type. Here is one of the provided test code:
let grid = ["clojurermt"]
let words = ["clojure"]
var expected = [String: WordLocation?]()
expected["clojure"] = WordLocation(
start: ["column": 1, "row": 1],
end: ["column": 7, "row": 1]
)
Is this the actual test being carried out?
After reviewing some of the Community Solutions, I realized that we need to use the nested type WordLocation.Location to specify the row and column, e.g.
WordLocation(
start: WordLocation.Location(row: r1, column: c1),
end: WordLocation.Location(row: r2 column: c2)
)
So, are the sample tests provided in the Exercise page out of date?
=============
EDIT: Okay, I read the error message more carefully. It stated
error: cannot convert value of type '[String : Int]' to expected argument type 'WordLocation.Location'41 | 42 | return WordLocation(43 | start: ["column": c0+1, "row": r0+1],
when I ran code with
WordLocation(
start: ["column": c0+1, "row": r0+1],
end: ["column": endCol + 1, "row": endRow + 1]
)
I guess I should have deduced that I need to use WordLocation.Location, but still, it would be nicer if there’s some discussion on the return type WordLocation.
