Are the #if DEBUG statements really needed for previews in SwiftUI to remove it in a release build?

NOTE: To be extra clear, you DO NOT need to wrap your preview providers in #if DEBUG conditionals. They are removed from your production build.

I’m a little late, but I just had to make note of this because the confusion is all over the web and it turns out to be quite comical. The release note was under “Resolved Issues” and the title of the resolved ticket was “PreviewProviders aren’t properly removed from built products when archived. (51539802)“.

Yeah, it all makes sense now.

The still
The proof

Annnd Just in case you think they may have changed it later….. more proof

(I’m thorough… maybe too much so)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)