Skip to content

[Bug] Generated mocks not accessible from within #Preview #31

Open
@ben-fortier

Description

@ben-fortier

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
}

Metadata

Metadata

Assignees

Labels

apple bugSomething isn't working, and it's an Apple bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions