回答編集履歴
3
weakだとselfのコードが通らないのでunownedに訂正。
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
timer = Timer.scheduledTimer(withTimeInterval: self.interval, repeats: true) { [we
|
17
|
+
timer = Timer.scheduledTimer(withTimeInterval: self.interval, repeats: true) { [unowned self] (timer) in
|
18
18
|
|
19
19
|
|
20
20
|
|
2
循環参照を修正([weak self]の追加)。キャプチャを参照に修正。(self.の追加)
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
timer = Timer.scheduledTimer(withTimeInterval: self.interval, repeats: true) { (timer) in
|
17
|
+
timer = Timer.scheduledTimer(withTimeInterval: self.interval, repeats: true) { [weak self] (timer) in
|
18
18
|
|
19
19
|
|
20
20
|
|
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
-
if self.count >= upperlimit {
|
35
|
+
if self.count >= self.upperlimit {
|
36
36
|
|
37
37
|
timer.invalidate()
|
38
38
|
|
1
バグ修正。タイマーのクロージャ内のif文にupperlimitを使うように修正。
test
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
-
if self.count >=
|
35
|
+
if self.count >= upperlimit {
|
36
36
|
|
37
37
|
timer.invalidate()
|
38
38
|
|