swiftxcodeunwind-segue

unwind segue freezes UI


I am using unwind segues in my app to dismiss multiple VCs and return to the original one. The unwind segue works but it freezes the UI for 2 sec when i press the button that triggers it. In the unwind function I do not have anything it is empty so it could not be the cause for the freeze. Please let me know what could be the cause and the solution. Thanks!


Solution

  • Found the problem: one of the VC had a viewWillAppear function that was preparing the cammera so when I was dismissing all the VCs with the unwind segue when it reached this particular one it was executing the ViewWillAppear function. I fixed it by adding a condition in the function when going backwards and now the 2 sec freeze is gone!