0
0

More than 3 years have passed since last update.

SwiftUIチュートリアルで Multiple commands produce というエラーが出た時の対処法

Last updated at Posted at 2021-04-04

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が表示できるようになる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0