I work on quite a large project, and we've started using SwiftUI Previews in the last year (I know, very late). We have functions for creating mocks that are surrounded by #if DEBUG to prevent them being used in production code.
However this means that the #Previews need to be surrounded by debug conditions as well, and sometimes this gets forgotten and is only caught when a release build is made twice daily (not at PR stage).
Is there anyway to mark a function as only available in DEBUG, or have the compiler check if a function inside a compile time directive, is called from somewhere that isn't inside the same directive?