Search code examples
iosswiftuikitvision

UIViewController can't override method from it's superclass


I am actually experimenting with the Vision Framework. I have simply an UIImageView in my Storyboard and my class is from type UIViewController. But when I try to override viewDidAppear(_ animated: Bool) I get the error message: Method does not override any method from its superclass Do anyone know what the issue is? Couldn't find anything that works for me...


Solution

  • So after looking at the code, you are declaring a new class called UIViewController. Maybe you meant extension instead of class.

    That's the reason the compiler could not find the method because you overwrote it by creating that new class by naming it UIViewController.

    You need to replace class UIViewController { with extension UIViewController {