Closed ngtk closed 4 years ago
らしいので、要注意。(自分ではまだ動作確認できていない汗)
モーダルを開く際、.fullScreen で完全に画面を覆わない限りは呼ばれないっぽいですね
https://twitter.com/koogawa/status/1164892755417415680?s=21
ref: https://medium.com/@hacknicity/view-controller-presentation-changes-in-ios-13-ac8c901ebc4e
Guarantee Rx memory leaks absence https://medium.com/flawless-app-stories/guarantee-rx-memory-leaks-absence-3a90636ec49e
以下のRxSwift を使ったコードでメモリリークしないことをUITest で保証したい
private let disposeBag = DisposeBag()
@IBOutlet private var button: UIButton!
@IBOutlet private var label: UILabel!
func viewDidLoad() {
super.viewDidLoad*(
button.rx.tap.subscribe(onNext: {
self.label.text = "Hello world" // self がキャプチャされる
})
.disposed(by: disposeBag)
}
RxSwift で RxSwift.Resources
を使用可能にする
https://github.com/ReactiveX/RxSwift/blob/master/Documentation/GettingStarted.md#enabling-debug-mode
RxSwift.Resources.total
を 上記コードの前後で比較して、キャプチャされている数を比較
func testRxDoNotLeak() {
// snapshot before
let expectedTotal = Resources.total
autoreleasepool {
let viewController = ViewController()
// trigger subscriptions placed in viewDidLoad
_ = viewController.view
}
// snapshot after
let actualTotal = Resources.total
XCTAssertEqual(expectedTotal, actualTotal)
}
Why
Where
Pearl Jam (Subject to change)
5F, MG Shirokanedai Building (Wantedly, Inc. Tokyo HQ)
Who
You are working for Wantedly? Sure, you can join anytime. If not, you need to contact us first. Or, you can "want to visit" the meetup, which you can find in www.wantedly.com/companies/wantedly/projects.
What
You write topics like below contents and we talk about these on the meetup. Every participant needs to write one topic at least.
Also, you can find new topics from the newsletters:
How
・・・
参加者は開催までに話したいことを少なくとも1トピックをコメントしましょう。 ネタ被りを避けるために、まずはタイトルだけでコメントすることを推奨します。 より多くの学びを得るためにどんな内容でもアウトプットを歓迎します!😊
cc/ @wantedly/ios
Edit this template
Previous issue