This question is for devs building apps with Turbo-ios.
I want to disable the native “pull-to-refresh” functionality on certain pages.
I found the variable responsible for enabling/disabling the pull to refresh functionality in turbo-ios:
and it looks like I can disable pull to refresh in my VisitableViewController
subclass like this:
override func viewWillAppear(_ animated: Bool) {
self.visitableView.allowsPullToRefresh = false
}
The problem is that I want to “selectively disable pull to refresh depending on the URL of the page I am on”.
My current solution is to use “path_configuration” like this:
{
"rules": [
{
"patterns": ["/some/page"],
"properties": {
"disablePullToRefresh": "true"
}
}
]
}
Then inside of my navigate
function
private func navigate(
to viewController: UIViewController, action: VisitAction, properties: PathProperties = [:],
animated: Bool = true, url: URL
) {
// <cliped>
let disablePullToRefresh = getDisablePullToRefresh(properties)
if let viewController = viewController as? ApplicationViewController {
viewController.disablePullToRefresh = disablePullToRefresh
}
// <cliped>
}
And in my ApplicationViewController
:
class ApplicationViewController: VisitableViewController {
var disablePullToRefresh: Bool = false
override func viewWillAppear(_ animated: Bool) {
self.visitableView.allowsPullToRefresh = !disablePullToRefresh
super.viewWillAppear(animated)
}
}
Is there anybody out there who followed a different approach?
It would be better if I could decide from the server if want to allow or disallow pull to refresh… (by using a meta tag for example)
(I don’t want to release a new version to the app store every time I want to disable another page.)
Thank you