mirror of
https://github.com/ReactiveX/RxSwift.git
synced 2024-10-05 06:27:29 +03:00
[Fix] It looks like Apple fixed memory leak for UIButton
with iOS 10.2. #842
This commit is contained in:
parent
582807e83b
commit
9d7ab84920
@ -15,12 +15,12 @@ import RxSwift
|
||||
|
||||
|
||||
extension Reactive where Base: UISwitch {
|
||||
|
||||
|
||||
/**
|
||||
Reactive wrapper for `on` property.
|
||||
|
||||
**⚠️Unlike other controls, Apple is reusing instances of UISwitch or a there is a leak,
|
||||
so underlying observable sequence won't complete when nothing holds a strong reference
|
||||
**⚠️ Versions prior to iOS 10.2 were leaking `UIButton`s, so on those versions
|
||||
underlying observable sequence won't complete when nothing holds a strong reference
|
||||
to UISwitch.⚠️**
|
||||
*/
|
||||
public var value: ControlProperty<Bool> {
|
||||
|
@ -127,7 +127,7 @@ extension FlowTests {
|
||||
_testBarButtonItemTap,
|
||||
_testButtonTap,
|
||||
_testSegmentedControl,
|
||||
//_testUISwitch,
|
||||
_testUISwitch,
|
||||
_testUITextField,
|
||||
_testUITextView,
|
||||
_testSlider
|
||||
|
@ -83,13 +83,9 @@ class APIWrappersViewController: ViewController {
|
||||
|
||||
// MARK: UISwitch
|
||||
|
||||
/*
|
||||
// also test two way binding
|
||||
let switchValue = Variable(true)
|
||||
/***⚠️Unlike other controls, Apple is reusing instances of UISwitch or a there is a leak,
|
||||
so underlying observable sequence won't complete when nothing holds a strong reference
|
||||
to UISwitch.⚠️***/
|
||||
(switcher.rx.value <-> switchValue).addDisposableTo(disposeBag)
|
||||
_ = switcher.rx.value <-> switchValue
|
||||
|
||||
switchValue.asObservable()
|
||||
.subscribe(onNext: { [weak self] x in
|
||||
@ -100,9 +96,8 @@ class APIWrappersViewController: ViewController {
|
||||
// MARK: UIActivityIndicatorView
|
||||
|
||||
switcher.rx.value
|
||||
.bindTo(activityIndicator.rx.animating)
|
||||
.bindTo(activityIndicator.rx.isAnimating)
|
||||
.addDisposableTo(disposeBag)
|
||||
*/
|
||||
|
||||
// MARK: UIButton
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user