Suppress unused variable warning for #Playground block

Hi,

Overview

  • I have a #Playground block to test some logic
  • It has some unused variables but they show their value on preview window, it is nice that is named variables so that this display the value.
  • Xcode doesn't throw warnings for unused variables
  • This Playground block is in the same file as some code it tests.

Problem

  • When running in CI it seems to throw unused variable warning

My attempts so far:

  • I have added a #if DEBUG condition surrounding it, but strangely enough this didn't solve the issue.

Questions

  1. Is there any solution to this problem?
  2. What is the recommended approach?

hi @somu - since this is somewhat specific to Xcode over Swift and it's warnings (at least if I'm reading this correctly), then I think this would be better filed as feedback for Xcode.

I'm assuming your CI is running xcodebuild, not swift build - is that right?

1 Like

Thanks a lot @Joseph_Heck
Fair point, this was running in Xcode cloud, will file a feedback

1 Like