rechsteiner / Parchment

A paging view with a highly customizable menu ✨
MIT License
3.36k stars 418 forks source link

How To Lazy Load Page #653

Closed rainedAllNight closed 1 year ago

rainedAllNight commented 1 year ago

I've got three pages, and when I set the default to select the second one, I don't want viewDidLoad on the first and third page to be called, it's initialized the first time I visit the corresponding page, what do I do

rechsteiner commented 1 year ago

Hi @rainedAllNight! Sorry for the late response. This is unfortunately not possible with Parchment, as the underlying PageViewController implementation always loads the sibling view controller. This is needed to avoid any lags when the user starts swiping, which could be noticeable if the view controller are heavy to initialise. This is the same behaviour as the built-in UIPageViewController. I suggest that you look into moving the code being called in viewDidLoad into viewWillAppear instead if that is possible.