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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -