uhooi / UhooiPicBook

Uhooi's character book.
MIT License
107 stars 25 forks source link

Add [weak self] #258

Closed uhooi closed 2 years ago

uhooi commented 2 years ago

Overview

クロージャで循環参照によるメモリリークが発生し得る(escaping していて self を使っている)箇所に [weak self] を追加した。

self のアンラップ方針として、 selfnil のときは異常系なので基本的には guard let self = self else { return } で最初に早期リターンするようにした。 しかし行数が増えるので、スッキリ書きたい場合はオプショナルチェインニングを使って self?.○○ と書くようにした。

References

codecov[bot] commented 2 years ago

Codecov Report

Merging #258 (55607f6) into develop (7c4f038) will increase coverage by 2.98%. The diff coverage is 54.54%.

:exclamation: Current head 55607f6 differs from pull request most recent head 2bfa0c6. Consider uploading reports for the commit 2bfa0c6 to get more accurate results Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #258      +/-   ##
===========================================
+ Coverage    52.97%   55.95%   +2.98%     
===========================================
  Files           10       10              
  Lines          185      193       +8     
  Branches        84       86       +2     
===========================================
+ Hits            98      108      +10     
+ Misses          87       85       -2     
Impacted Files Coverage Δ
...ook/Repository/Spotlight/SpotlightRepository.swift 12.00% <0.00%> (-1.05%) :arrow_down:
.../MonsterList/Presenters/MonsterListPresenter.swift 85.00% <33.33%> (-4.48%) :arrow_down:
...sterDetail/Presenters/MonsterDetailPresenter.swift 100.00% <100.00%> (ø)
Shared/Util/ImageCacheManager.swift 36.00% <0.00%> (+24.00%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f835155...2bfa0c6. Read the comment docs.