Home > Back-end >  Why XCode Storyboard not able to recognize unwind function in some UIViewController?
Why XCode Storyboard not able to recognize unwind function in some UIViewController?

Time:04-30

I notice in some case, XCode is not able to recognize unwind function in some UIViewController.

For instance, the following UIViewController has the following unwind functions.

  1. unwindFromShop
  2. unwindFromPreference

But, when I try to use StoryBoard to build unwind segue, it cannot recognize such functions in that view controller.

enter image description here

My current only workaround, is the select other unwind segue in other view controller, then rename Action accordingly.

enter image description here

There is no issue, to trigger run the unwind function, during simulator run.

I try to clean, build, restart XCode. Somehow, XCode still not able to recognize the unwind functions declared in that particular view controller.

I was wondering, is this bug in XCode? I am using Version 13.3.1 (13E500a)

CodePudding user response:

I was able to workaround the issue, by renaming ViewController class name to MainViewController.

After the renaming, the XCode seems to able to recognize the unwind functions again.

  • Related