Rxswift: Reporting UIKit iOS 10 issue: Why isn't UISwitch being deallocated ... ever, help wanted.

Created on 20 Aug 2016  Â·  3Comments  Â·  Source: ReactiveX/RxSwift

I'm asking for help on this. I have no idea why is this happening, but it looks like every instance of UISwitch isn't being deallocated ... ever

Simplest way to experience it:

class Switchy : UISwitch {
    deinit {
        print("bye, just smile and :wave: boys") // This will never be printed
    }
}

....

Switchy(frame: .zero) // never being deallocated
UISwitch(frame: .zero).rx.deallocating.subscribe(onNext: { _ in print("This will never be called") })
UISwitch(frame: .zero).rx.deallocated.subscribe(onNext: { _ in print("This will never be called") })
help wanted

Most helpful comment

Basic retain cycle.
UISwitch seems to retain an instance of a UISwitchModernVisualElement object through the _visualElement property, with retain itself the UISwitch element through the _switchControl property.
=> bugreport.apple.com ?

switchtest_xcodeproj 2
switchtest_xcodeproj

All 3 comments

Basic retain cycle.
UISwitch seems to retain an instance of a UISwitchModernVisualElement object through the _visualElement property, with retain itself the UISwitch element through the _switchControl property.
=> bugreport.apple.com ?

switchtest_xcodeproj 2
switchtest_xcodeproj

Oh yeah, good catch! It's happening on the beta as well, UISwitch is never deallocated.
As @JegnuX said, it seems an rdar is necessary.

I've just reported it on bugreport.apple.com ¯_(ツ)_/¯

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Z-JaDe picture Z-JaDe  Â·  3Comments

delebedev picture delebedev  Â·  3Comments

trungp picture trungp  Â·  3Comments

RobinFalko picture RobinFalko  Â·  3Comments

marlowcharite picture marlowcharite  Â·  3Comments