Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appearance transitions #426

Closed
wants to merge 12 commits into from
Closed

Conversation

dginsburg
Copy link

No description provided.

@rechsteiner
Copy link
Owner

rechsteiner commented Mar 4, 2020

Hi @dginsburg! Sorry for the late reply, I just got back from vacation. I'm struggling a bit to get an overview over what is related to just updating EMPageViewController here and what is fixing issues with the appearance transition.

I gradually started shifting away from the official version a while back because I found some issues, and unfortunately I never got around to contributing back into EMPageViewController. I'll start tracking down all the changes that I've made and see if I can get them merged into the official version.

Can you explain a bit more what's the issue with appearance transitions you are facing?

@dginsburg
Copy link
Author

Hi @rechsteiner. Sorry for the confusion. I left this as a draft and didn't intend for you to look at it yet. I forgot that it would show up as PR for you. I'll certainly write up an explanation if I submit it.

The most significant problem I had was that viewWillAppear was being called on my view controller before it had been installed as a child of EMPageViewController or added as a subview. That was the one that broke my code, but other appearance transitions were also called out of order. Apple documents the order but, unfortunately, it's sprinkled around the UIViewController page.

The code you wrote for Parchment works perfectly and thank you for creating this project. It's really nice design that you allowed me to subclass any view and customize the layout.

I've had to put this aside as we're preparing for a product launch and the feature that uses Parchment might not make it. I'm probably going to further fork it an incompatible way but I'll clean this up and submit it with an explanation when I get back to it.

@rechsteiner
Copy link
Owner

Sounds good! Thank you for looking into this. I've been planning on replacing EMPageViewController with custom implementation, but it will probably take some time before I manage to get that done so it's better to get this fixed first.

Very excited to see what you are building with Hey. Good luck with the launch!

@dginsburg
Copy link
Author

I've been planning on replacing EMPageViewController with custom implementation

EMPageViewController is what I will likely fork/replace from Parchment. It would be better for my needs if the view controllers and their views stayed as children/subviews. It causes a stutter in my UI because viewWillAppear triggers an expensive refresh. I'd rather everything stay in place and I use the delegate methods if I need to do things when the pages are visible or not. I suspect I could then enable regular view controller lifecycle forwarding and rely on the OS for all that.

Very excited to see what you are building with Hey. Good luck with the launch!

Thanks! I've still got hope I can get the Parchment based feature in for launch.

@rechsteiner
Copy link
Owner

Ah, I see. You can actually provide your own page view controller without creating a fork. I recently added support for using the menu as a standalone component (#379). You can then hook it up with your own UIScrollView subclass where you control the lifecycle of the view controllers.

I haven't gotten around to documenting that feature very well. Basically you need to implement the PagingMenuDataSource and PagingMenuDelegate. When the user scrolls in your custom page view, you need to call contentScrolled and contentFinishedScrolling on the menu. You also need to call viewAppeared and transitionSize when the view appears or transitions its size. I'll look into creating an example project that shows how this work.

That said, it sounds a bit like it would be easier to refactor the way you are fetching data in your view controller. If you're caching the view controllers in your data source (or using init(viewControllers:) and doing the fetching in viewDidLoad, it should only happen once.

@rechsteiner rechsteiner mentioned this pull request Mar 12, 2020
4 tasks
@rechsteiner rechsteiner mentioned this pull request Apr 3, 2020
5 tasks
@rechsteiner
Copy link
Owner

Hi @dginsburg! I've made some good progress on the custom page view controller implementation. It should much more reliable when it comes to appearance transitions now. It also fixes an issue with way too many appearance transitions being started/ended when flicking fast to the next page: #468 (comment)

Could you try to target the 3.0 branch and see if it fixes the issues that you were having?

@rechsteiner
Copy link
Owner

Version 3.0 is now available: https://github.com/rechsteiner/Parchment/releases/tag/v3.0.0.

Let me know if you find any issues!

@rechsteiner rechsteiner closed this Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants