I'm trying to implement the required methods of viewWillTransition but I'm getting a weird error:
Invalid redeclaration of 'viewWillTransition(to:with:)'
I've used it in swift 2 without problem But Swift 3 error
my Code :
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator){
super.viewWillTransition(to: size, with: coordinator)
guard let pageIndex = imageScrollView.auk.currentPageIndex else { return }
let newScrollViewWidth = size.width
coordinator.animate(alongsideTransition: { [weak self] _ in
self?.imageScrollView.auk.scrollToPage(atIndex: pageIndex, pageWidth: newScrollViewWidth, animated: false)
}, completion: nil)
}
Invalid redeclaration of
viewWillTransition(to:with:)
It means by mistake you have added viewWillTransition
method twice in your Controller remove one of it will solved the error.