I am having an issue when previewing a UIKit ViewController. I am developing my app inside Pods framework which then I import and use in scene/app delegate. I tried to use UIKit to have SwiftUI previews. I conformed to UIViewRepresentable protocol and made a struct that conforms to PreviewProvider where I returned the current controller as some View. I have many external dependencies like Moya, Alamofire, SnapKit...
I am building my components in Pods project. Which I import than into scene/app delegate to start the app.
I am getting the error: "Cannot preview in this file; Unexpected error occurred". I went online and found some people saying that I need to disable Automatically Refresh Canvas setting. But it still doesn't work. I am then getting an error: "Cannot preview in this file; Update failed". I attached a file with a generated report from the error. I also cleaned the build folder and restarted my Mac. I am using Macbook Pro M2.
If I run UIKit previews in a new project it works. But I need it to be able to run in my current project.
https://www.notion.so/Xcode-Previews-UIKit-Error-Report-ba5ec69080f34cb09c6f93c6cd0131d7?pvs=4