classPropertiesClass1 {varA ="Stringa"init () {print ("Initialize") }}classPropertiesClass2 {varID =0 //Lazy lazy loading, only when used to triggerLazyvarProperties1 =PropertiesClass1 ()//initialization must initialize all of the properties, or the options varName:string?//Geter Seter varqq:string {//Geter Seter Inside cannot use own attribute, otherwise will die loop Get { returnself.name! } Set{self.name=NewValue}} //read-only properties varHeight:int {return the } varAddress:string ="XXX"{willset {print ("new value \ (newvalue)")} didset {print ("old value \ (oldValue)") } } varFunction_properties = {return "Properties"}() }varProperties2 =PropertiesClass2 () print (properties2.properties1) properties2.qq="65683264"print (PROPERTIES2.QQ) print (properties2.height)//properties2.height = 2properties2.address="CA"print (properties2.function_properties)
Swift INIT initialization