1

Swift と Vapor は初めてなので、Vapor プロジェクトを試しています。MySQL for Swiftを介して DB からデータを取得ResultSetし、Leaf テンプレートに渡す単純なルートがあります。これが私が試みていることです:

drop.get("report") {req in
    let data = try mysql.execute("select * from things")
    return try drop.view.make("report", ["data":data])
}

しかし、Swift は次のエラーで不平を言います:

error: cannot convert value of type '[[String : Node]]' to expected dictionary value type 'Node'
return try drop.view.make("report", ["data":data])
                                            ^~~~

型キャストのステップが抜けているように感じますが、それは何ですか?

4

1 に答える 1