Skip to content

Improve unused check for previews #1128

Description

@bsudekum

If you have something like:

#Preview {
  let viewModel = ViewModel()
  MyView(viewModel: viewModel)
}

and MyView is actually used elsewhere, viewModel is called out as unused. I'd rather not enable retain-swift-ui-previews because then if MyView is actually unused, it wouldn't get called out as unused.

The ideal situation is viewModel is not called out as unused, bc it is technically used in the preview.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions