You can't use a generated mock inside of a #Preview. The workaround is to use a preview struct that conforms to PreviewProvider instead, but it would be nice to be able to use #Preview.
Example:
@Mocked protocol Dependency {
var value: Int { get }
}
// even in a new file
#Preview {
let dependencyMock = DependencyMock() // not found
}
You can't use a generated mock inside of a
#Preview. The workaround is to use a previewstructthat conforms toPreviewProviderinstead, but it would be nice to be able to use#Preview.Example: