The @discardableResult Attribute in Swift
3 min readMar 19, 2021
Swift has several small features as a language, many of them being neglected quite often while they consist of small programming gems. One of them is the @discardableResult
attribute that everybody wish they knew from the beginning.
What’s the purpose of @discardableResult
? Put in simple words, when used to annotate a method, then the returned value of the method can be ignored when it gets…