SwiftUIのチュートリアルに取り組んでいたところ、エラーが出てきました。とりあえず解決したので対処法をまとめておきます。
初心者ですので、間違っていたらご教授ください🙇♂️
状況
SwiftUIのチュートリアルをやっていたところMultiple commands produce
という文言で始まるエラーに遭遇した。
場所:Building Lists and Navigation Section 2 Step 4
原因
landmarkData.json が2箇所にある。
Section1 Step 11 でフォルダ階層を整える操作がある。
この時にResourcesを移動させずに新しく作成してしまうと、landmarkData.jsonがLandmarks直下のResourcesフォルダとLandmarks/Landmarks/Resourcesの2箇所にlandmarkData.jsonが配置されてしまう。
この後に、Section2の操作を続けていくとプレビュー表示の際にエラーとなる。
対処
Landmarks直下のResourcesフォルダの中身をすべてLandmarks/Landmarks/Resourcesにうつし、Landmarks直下のResourcesフォルダを削除する。(チュートリアルではそもそもこういう意味の指示だったようだが、間違えて読んでしまった。)
LandmarkRow.swiftに戻って、Previewでtry againを押すと問題なくPreviewが表示できるようになる。