ios - lazy attribute in Swift equivalent to lazy Init getter in Objective C -
is lazy attribute in swift equivalent overriding getter lazy loading pattern in objective c?
from docs:
a lazy stored property property initial value not calculated until first time used. indicate lazy stored property writing lazy attribute before declaration.
so, mostly, yes.
you must declare lazy property variable (with var keyword), because initial value may not retrieved until after instance initialization completes. constant properties must have value before initialization completes, , therefore cannot declared lazy.”
remember on swift have option declare custom getters , setters properties:
var name : string?{ get{ return "oscar" } set(newvalue){ } }
Comments
Post a Comment