Open phoney opened 7 years ago
@phoney please see https://github.com/gontovnik/DGRunkeeperSwitch/pull/48/files
Thanks. I did look at it and gave it a +1 two weeks ago.
Can it be merged?
need to ask @gontovnik
This is fixed by Pull Request #48, which should be merged.
Thank you very much it helped me a lot
On iOS 11 there are increased warnings related to KVO and the KVO code in DGRunkeeperSwitch.swift doesn't work. I get this assertion failure [MyTests.TableViewCellTest testOutlets] : failed: caught "NSUnknownKeyException", "[<DGRunkeeperSwitch.DGRunkeeperSwitch 0x7feec8220100> addObserver:<DGRunkeeperSwitch.DGRunkeeperSwitch 0x7feec8220100> forKeyPath:@"selectedBackgroundView.frame" options:1 context:0x0] was sent to an object that is not KVC-compliant for the "selectedBackgroundView" property."
I fixed this problem as follows:
In finishInit I changed to this
selectedBackgroundView.addObserver(self, forKeyPath: "frame", options: .new, context: nil)
In observeValue forKeyPath I changed to this
override open func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { if let view = object as? UIView { if keyPath == "frame" && view == selectedBackgroundView { titleMaskView.frame = selectedBackgroundView.frame } } }
and