Swift โฉ basic types โฉ function โฉ return value โฉ discardable
// โญ๏ธ to silence the compiler from warning // 1. use @discardableResult at declaration (compile-time) @discardableResult func f() -> Int { ... } // 2. use _ at call site (run-time) let _ = g();
SwiftLee โฉ @discardableResult in Swift explained: Ignoring return values
Sarun โฉ What is @discardableResult
Paul โฉ How to ignore return values using @discardableResult
example in fully qualified name
Last updated 2 years ago