반응형
How to ignore return value?
Sometimes you might want to ignore the return value while in other cases you might use it.
In that situation, you can use @discardableResult attribute!
Let's see example.
When you call update function like below.
You will see warning :(
You might fix the warning like this.
But it's ugly code.
In that case, you could use @discardableResult attribute.
It will fix warning!
Happy coding :)
반응형
그리드형
'개발 > swift' 카테고리의 다른 글
Swift scene delegate vs app delegate (0) | 2020.12.16 |
---|---|
Swift How to init keychain when app deleted? (0) | 2020.12.12 |
Swift drag, drop and reorder collectionView Cell (0) | 2020.12.04 |
Swift try catch error handling (0) | 2020.12.01 |
Swift new feature in ios14, IDFA (0) | 2020.11.26 |