Xcode Previews don't seem to work for nested directories

I've set a Swift Package for some SwiftUI views. It looks like Xcode Previews do work for files directly under the target directory. But break once you add any nesting.

Code Block
// -- Sources/Foo/RootView.swift --
import SwiftUI
struct RootView: View {
    var body: some View { Text("Hello, World!") }
}
// Works!
struct RootView_Previews: PreviewProvider {
    static var previews: some View { RootView() }
}


Code Block
// -- Sources/Foo/Subviews/SubView.swift --
import SwiftUI
struct SubView: View {
    var body: some View { Text("Hello, World!") }
}
// Error!
// NoBuildableEntriesError: active scheme does not build this file
// Select a scheme that builds a target which contains the current file, or add this file to a target that is built by the current scheme.
struct SubView_Previews: PreviewProvider {
    static var previews: some View { SubView() }
}


The "Generate Report" button also seems broken for this case. It just opens finder to the root temp directory and doesn't seem to dump any specific logs.

Xcode 12.0 beta (12A6159)
Answered by Developer Tools Engineer in 617787022
The same question was asked here, and has a suggested workaround until the bug is fixed:
https://developer.apple.com/forums/thread/650573
Accepted Answer
The same question was asked here, and has a suggested workaround until the bug is fixed:
https://developer.apple.com/forums/thread/650573
Xcode Previews don't seem to work for nested directories
 
 
Q