Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"final let" purpose in Swift, is it not redundant?

Tags:

swift

Is it not redundant to use final let as let is already a constant and can not be modified? In which cases is that useful?

like image 492
Felipe Santiago Avatar asked Oct 31 '25 19:10

Felipe Santiago


1 Answers

It means the variable won't be dynamically dispatched, which can improve performance.

However, if you declare your class final, it's redundant to declare the individual variables/members of that class final.

like image 133
Claus Jørgensen Avatar answered Nov 03 '25 10:11

Claus Jørgensen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!