回答編集履歴
3
修正
test
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
`Swift3`から戻り値を使うことが強要されるようになりました、使わないとワーニングが出ますので以下のように「アンダーバー」で受けてください。
|
2
|
+
|
3
|
+
参考URL: [Defaulting non-Void functions so they warn on unused results](https://github.com/apple/swift-evolution/blob/master/proposals/0047-nonvoid-warn.md)
|
2
4
|
|
3
5
|
|
4
6
|
|
2
修正
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
```swift
|
6
6
|
|
7
|
-
_ = self.navigationController?.popViewController(animated: true)
|
7
|
+
_ = self.navigationController?.popToRootViewController(animated: true)
|
8
8
|
|
9
9
|
```
|
10
10
|
|
1
修正
test
CHANGED
@@ -7,3 +7,19 @@
|
|
7
7
|
_ = self.navigationController?.popViewController(animated: true)
|
8
8
|
|
9
9
|
```
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
`@discardableResult`を付けると戻り値を使わなくてもワーニングにならないようにできます。
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
```swift
|
18
|
+
|
19
|
+
@discardableResult func doSomething() -> Bool {
|
20
|
+
|
21
|
+
return true
|
22
|
+
|
23
|
+
}
|
24
|
+
|
25
|
+
```
|