Use @discardableResult To Choose Whether To Use Return Values
Daily Coding Tip 027

If you want to call a function that returns a value called addValues(), you’ll notice that it gives you a warning that says “Result of call to addValues() is unused.” You may not always want to use the result, so there’s an easy way to suppress this warning.
Adding @discardableResult before your function declaration gives…
Keep reading with a 7-day free trial
Subscribe to Type Safely to keep reading this post and get 7 days of free access to the full post archives.

