computed property (get/set)
accessor╱getter/setter╱🚧 -> keyword "let"
Last updated
Was this helpful?
accessor╱getter/setter╱🚧 -> keyword "let"
Last updated
Was this helpful?
⟩ ⟩ ⟩ computed property
屬性沒有實際儲存的值,值是動態計算的。
computed property 的優勢:
get
:可動態計算並傳回屬性值。
set
:可攔截屬性變更,檢查或調整其值,保護內部。
📁 測試
: A basic feature for safer and cleaner code
Develop with Swift ⟩
property observer (willSet/didSet): you can add in computed properties that you .
Swift ⟩ ⟩