I have 2 tabs, and each has a UITableView using SwiftPulltoRefresh. In my case I am using a custom header but int shouldn't matter. You will notice that on the second UITableView created the pull to refresh won't work. The animation still happens but the refresh completion handler is never called. Also sometimes the content insets and offset are not properly reset.
This is because every instance of a scrollview points to the same header.
In UIScrollView+Extensions.swift you define:
private var headerKey: UInt8 = 0
Every time you reference spr_header you call objc_getAssociatedObject with the exact same key.
My quick and dirty solution was to define headerKey as:
Here is the current situation:
I have 2 tabs, and each has a UITableView using SwiftPulltoRefresh. In my case I am using a custom header but int shouldn't matter. You will notice that on the second UITableView created the pull to refresh won't work. The animation still happens but the refresh completion handler is never called. Also sometimes the content insets and offset are not properly reset.
This is because every instance of a scrollview points to the same header.
In UIScrollView+Extensions.swift you define:
private var headerKey: UInt8 = 0
Every time you reference spr_header you call objc_getAssociatedObject with the exact same key.
My quick and dirty solution was to define headerKey as:
private var headerKey: UInt32 = 0
and in spr_setCustomHeader:
public func sprsetCustomHeader( header: RefreshView) { headerKey = UInt32(arc4random()) self.spr_header = header }
Now each scrollview has a unique key for each header and there are no more issues. You need to do this for footerKey and tempFooterKey as well.