`@discardableResult override init ()` in Swift 3.1, throwing a warning `warn_unused_result` Objective-C

I have a Swift class that is connected to Objective-C. Even with @discardableResultit, it throws this warning when building in the Objective-C class:

Ignoring the return value of the function declared with the attribute 'warn_unused_result'

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

+4
source share
1 answer

When clicked (void), the warning should be turned off:

(void)[SingletonClass sharedInstance];
+1
source

Source: https://habr.com/ru/post/1673422/


All Articles