pull-to-refresh
pull-to-refresh copied to clipboard
fatal error: attempted to read an unowned reference but the object was already deallocated
Xcode 9 / Swift 4
on self.addObserver(newSuperview) of ESRefreshComponent
open override func willMove(toSuperview newSuperview: UIView?) {
super.willMove(toSuperview: newSuperview)
/// Remove observer from superview immediately
self.removeObserver()
DispatchQueue.main.async { [unowned self, newSuperview] in
/// Add observer to new superview in next runloop
self.addObserver(newSuperview)
}
}