iosswiftviewdidappear

ViewDidAppear animation false


I wanted to disable animated in viewDidAppear. I've set the code below but it shows me this error:

"cannot assign to value: 'animated' is a 'let' constant"

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated = false)
}

Solution

  • You are trying to assign a value to the animated parameter and parameters are let constants, hence the error.

    If you simply want to pass false to super.viewDidAppear then simply pass false:

    super.viewDidAppear(false)
    

    There is no need to attempt to assign a value to the original animated property.