Trying to integrate SwiftUI into an large existing project. I have followed steps to integrate this into my project, but when I try to preview my new SwiftUI view file, I get the error..
Cannot preview in this file - current target needs adjusted build settings
There is a little (i) symbol at the end which states..
"project.app" needs -Onone Swift optimization level to use previews
I have added my Scene delegate though the SwiftUI file is not the root view controller so I made careful attention of leaving willConnectTo method empty.
By default under my Project < Build Settings < Swift Compiler - Code Generation < Optimization Level.. Debug is set to No Optimization[-Onone], release is Optimize for Speed[-O]... This is the same settings as my practice SwiftUI project.
I have tried a number of solutions but nothing has worked yet.
Reviewing the license agreement in the terminal
Checking my Command Line Tools
Edit my Info.plist - Though this didn't solve it, it seems like this was something important to do.
Ultimate Explanation For Integration that I followed
Ensuring the Debug config is chosen in Product -> Scheme -> Edit Scheme -> Build Configuration helped me to solve the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With