質問編集履歴

2

追加

2020/04/22 08:04

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -65,3 +65,17 @@
65
65
 
66
66
 
67
67
  ```
68
+
69
+
70
+
71
+ ---
72
+
73
+ 備忘録
74
+
75
+
76
+
77
+ ```swift
78
+
79
+ let lastIndex: Int? = array.lastIndex(where: { $0.type == .fuga })
80
+
81
+ ```

1

訂正

2020/04/22 08:04

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- `class A`には`Equatable`を適用するような要素がないのでobject同士の比較ができないのですが、このような`A`の配列`array`から`A.type == .fuga`な要素の最終インデックスを取得する方法はありますか?
1
+ `class A`には`Equatable`を適用するような要素がないのでobject同士の比較ができないのですが、このような`A`の配列`array`から`A.type == .fuga`な要素の最終インデックスをダイレクトに取得する方法はありますか?
2
2
 
3
3
 
4
4