質問編集履歴

1

質問画面でyesを押した時のメソッドの追加

2020/07/01 01:12

投稿

987654321
987654321

スコア28

test CHANGED
File without changes
test CHANGED
@@ -23,6 +23,40 @@
23
23
  }
24
24
 
25
25
  goNextQuestion()
26
+
27
+ }
28
+
29
+
30
+
31
+
32
+
33
+ func goNextQuestion() {
34
+
35
+      // 次の質問がない場合は結果画面に行く
36
+
37
+ guard let nextQuestion = QuestionDataMannager.shareInstance.nextQuestion() else {
38
+
39
+ if let resultViewController = storyboard?.instantiateViewController(identifier: "result") as? ResultViewController {
40
+
41
+ present(resultViewController, animated: true, completion: nil)
42
+
43
+ }
44
+
45
+ return
46
+
47
+ }
48
+
49
+
50
+
51
+ // 次の質問へ行く
52
+
53
+ if let nextQuestionViewController = storyboard?.instantiateViewController(withIdentifier: "question") as? QuestionViewController {
54
+
55
+ nextQuestionViewController.questionData = nextQuestion
56
+
57
+ present(nextQuestionViewController, animated: true, completion: nil)
58
+
59
+ }
26
60
 
27
61
  }
28
62