Delta icon indicating copy to clipboard operation
Delta copied to clipboard

Update page control on games view

Open romaintalleu opened this issue 4 years ago • 1 comments

Just fixed page control alignment & add page control select action for iOS14

IMG_C47BB679A320-1

romaintalleu avatar Feb 12 '21 12:02 romaintalleu

Looking great! The only thing I can see to make this even sweeter would be to give pageControlValueChanged some logic to handle dynamic setViewControllers direction based on the PageControl direction rather than always pushing the new Page forward.

Something like adding a local private variable to track the last selected page index and checking against that would work:

var direction = UIPageViewController.NavigationDirection.forward

if let lastIndex = self.lastSelectedSectionIndex, lastIndex > sender.currentPage
{
    direction = .reverse
}

self.lastSelectedSectionIndex = self.pageControl.currentPage

pageViewController.setViewControllers([destinationViewController], direction: direction, animated: true) { [weak self] _ in

...

Either way this is a great addition! Thanks for opening it, hope to see it added to Delta one day.

ianclawson avatar Jul 15 '21 06:07 ianclawson