What is de-initializer and how it is written in Swift?



What is de-initializer and how it is written in Swift?..

Answer / iosraj

A de-initializer is declared immediately before a class instance is de-allocated. You write de-initializer with the deinit keyword. De-initializer is written without any parenthesis, and it does not take any parameters. It is written as

deinit {

// perform the deinitialization

}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Apple iOS Swift Interview Questions

Does swift have a garbage collector?

0 Answers  


Is ios written in swift?

0 Answers  


What is mvvm in swift?

0 Answers  


Can you explain any three-shift pattern matching techniques?

0 Answers  


What do you mean by the term “defer”?

0 Answers  






Is swift written in c++?

0 Answers  


How to create a constant in swift programming?

0 Answers  


struct Planet { var name: String var distanceFromSun: Double } let planets = [ Planet(name: "Mercury", distanceFromSun: 0.387), Planet(name: "Venus", distanceFromSun: 0.722), Planet(name: "Earth", distanceFromSun: 1.0), Planet(name: "Mars", distanceFromSun: 1.52), Planet(name: "Jupiter", distanceFromSun: 5.20), Planet(name: "Saturn", distanceFromSun: 9.58), Planet(name: "Uranus", distanceFromSun: 19.2), Planet(name: "Neptune", distanceFromSun: 30.1) ] let result1 = planets.map { $0.name } let result2 = planets.reduce(0) { $0 + $1.distanceFromSun } What are the types and values of the result1 and result2 variables? Explain why.

1 Answers  


Is swift coding easy?

0 Answers  


Mention what is the characteristics of Switch in Swift?

1 Answers  


Explain what is optional chaining?

1 Answers  


In swift, what type of object are basic data types?

0 Answers  


Categories