SolvedPulley Is there any way of preventing the drawer from jumping on load?
✔️Accepted Answer
Hi,
Thanks for the quick answer but I am not sure how to use it (and I think I did not explain really well the issue).
Bug explanation
I do not call setDrawerPosition
at all, it's the initialDrawerPositionFromIB
that is broken when used in another tab.
As you can see, I use Pulley
in the second tab.
When I open it, even if the initialDrawerPositionFromIB
is set to "collapsed", the drawer is animated from the top.
Here is the stack leading to setDrawerPosition(position: .collapsed, isAnimated: true)
PulleyViewController.viewDidLoad()
↘️ PulleyViewController.primaryContentViewController.didset
↘️ PulleyViewController.setNeedsSupportedDrawerPositionsUpdate()
↘️ PulleyViewController.supportedPositions.didset
↘️ PulleyViewController.setDrawerPosition(position:isAnimated:) //animated is true
You can simply debug it in the attached sample project by adding a breakpoint in PulleyViewController.setDrawerPosition()
at the first line and see that the first call is animated.
Proposed solution
My proposed solution was to allow us the override setDrawerPosition
.
The reason is that you may not want to manage this special case (in which Pulley is embed a another tab) as it may have side effects on the "natural" use case.
In this case, I would use a class extending PulleyViewController
and forcing animation to false if the call is the first one (even if I agree, it would just be a workaround).
The ideal solution would be to make it work in my case though.
I hope that I have made it clearer and sorry if not (I am relatively new to iOS development).
Other Answers:
Okay, after some additional testing I've gone ahead and pushed this fix out to CocoaPods. It's version '2.2.9'. Assuming you haven't pinned your Pulley version, you can get the update by doing pod update Pulley
. You made need to run pod repo update
first.
Since this seems to be important to a lot of people, I'm gonna tag the people interested in this thread below so they see the notification.
@cyrilzakka @PomepuyN @azurechen @azhang66 @Vadim4016 @pablomarcos
If anyone has any issues, please let me know. I'll try to get them taken care of ASAP. Once a few people have reported back with success, then I'll close the issue. Thanks, everyone.
When first initializing the drawer, it seems everything is being animated from the top left of the screen into position. Is there any way of preventing this?