Skip to content

Commit 5093be2

Browse files
authored
Merge pull request #69 from jkates1/patch-1
Avoid possible retain cycles in animation completion handler on dismi…
2 parents 28c52de + 8968dce commit 5093be2

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Sources/BarcodeScannerController.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ open class BarcodeScannerController: UIViewController {
112112
self.infoView.frame = self.infoFrame
113113
self.infoView.status = self.status
114114
},
115-
completion: { _ in
115+
completion: { [weak self] _ in
116116
if delayReset {
117-
self.resetState()
117+
self?.resetState()
118118
}
119119

120-
self.infoView.layer.removeAllAnimations()
121-
if self.status.state == .processing {
122-
self.infoView.animateLoading()
120+
self?.infoView.layer.removeAllAnimations()
121+
if self?.status.state == .processing {
122+
self?.infoView.animateLoading()
123123
}
124124
})
125125
}
@@ -378,11 +378,11 @@ open class BarcodeScannerController: UIViewController {
378378
animations: {
379379
flashView.alpha = 0.0
380380
},
381-
completion: { _ in
381+
completion: { [weak self] _ in
382382
flashView.removeFromSuperview()
383383

384384
if whenProcessing {
385-
self.status = Status(state: .processing)
385+
self?.status = Status(state: .processing)
386386
}
387387
})
388388
}

0 commit comments

Comments
 (0)