6

I have a Swift class that is bridged to Objective-C. Even with @discardableResult, it's throwing this warning on build in the Objective-C class:

Ignoring return value of function declared with 'warn_unused_result' attribute

Is there a way to silence this? This is in Xcode 8.3 with Swift 3.1.

Sulthan
  • 128,090
  • 22
  • 218
  • 270
Ben Guild
  • 4,881
  • 7
  • 34
  • 60

1 Answers1

2

A cast to (void) should silence the warning:

(void)[SingletonClass sharedInstance];
weak
  • 99
  • 1
  • 3