MacOS X Document shortcuts

How to call deinit in Swift

Question or problem in the Swift programming language: I wrote a code block as the following: class Person{ let name:String; init(name:String){ = name; println(“\(name) is being initialized.”); } deinit{ println(“\(name) is being deInitialized.”); } } var person:Person?; person = Person(name:”leo”); person = nil; When initialized,print is ok. When set person to nil,the deinit method […]

Continue Reading