J.Arji
J.Arji

Reputation: 661

Invalid redeclaration of 'viewWillTransition(to:with:)' in swift 3

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)

    }

Upvotes: 1

Views: 1103

Answers (1)

Nirav D
Nirav D

Reputation: 72450

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.

Upvotes: 1

Related Questions