Skip to content

Conversation

@danwood
Copy link
Contributor

@danwood danwood commented Jan 12, 2026

Fixes issue #1046

This yields unused warnings (unless --retain-swift-ui-previews option) on any code only used by #Preview code.
The newer #Preview macro works quite differently than the old PreviewProvider, so the algorithm to detect it is a bit more involved. I've created some tests, and I've also exercised it on a big code base with lots of code that's only used by its previews, that Periphery wasn't picking up on.

@ky1ejs
Copy link

ky1ejs commented Jan 24, 2026

Thanks so much for handling this @danwood! And thanks all for this awesome software.

@ileitch would it be possible to merge and release this? Would love to have it. Just discovered some views that weren't caught as unused because of this issue.

@ileitch
Copy link
Contributor

ileitch commented Jan 25, 2026

Thanks for taking a go at this, @danwood. I took a different approach in #1051 and #1056 that's a bit more generalized, and requires less specific handling of #Preview

@ileitch ileitch closed this Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants