LoginSignup
0
0

More than 1 year has passed since last update.

エラーコード"Value of type '[indexPath]?' has no member 'row'"の表示について

Last updated at Posted at 2022-12-02

テキスト学習中に以下のエラーに遭遇しました。
Value of type '[indexPath]?' has no member 'row'

訳すと。
タイプ '[indexPath]?' の値は、メンバー 'row' を持っていません。

スクリーンショット 2022-12-02 11.28.50.png

以下の検索結果を実行
https://developer.apple.com/forums/thread/76086

以下のコードへ変更
修正前
indexPathsForSelectedRows →
修正後
indexPathsForSelectedRows?.first

スクリーンショット 2022-12-02 11.29.13.png
解決しました。

記事にも記載の通りこの状況だと複数のdexPathを返す可能性があったため、エラーが発生したのかなと思います。そのため.firstにより配列の中から一つの要素を選択させる必要があったのかなと思います。

**終わりに
すぐ検索結果に辿り着けてよかったです。
教材の通り進めていてもこういったことが多々あるのでその都度調べて対応していけたらなと思います。

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