Answer Posted / iosraj
As per Apple's Docs
Initialization is the process of preparing an instance of a class, structure, or enumeration for use. This process involves setting an initial value for each stored property on that instance and performing any other setup or initialization that is required before the new instance is ready for use.
You implement this initialization process by defining initializers, which are like special methods that can be called to create a new instance of a particular type. Unlike Objective-C initializers, Swift initializers do not return a value. Their primary role is to ensure that new instances of a type are correctly initialized before they are used for the first time.
Initializers
Initializers are called to create a new instance of a particular type. In its simplest form, an initializer is like an instance method with no parameters, written using the init keyword:
init() {
// perform some initialization here
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What do you do when you realize that your app is prone to crashing?
What is a lazy var in swift?
What is singleton class swift 3?
What is the difference between swift and xcode?
How does closure work in swift?
What is bridging header in swift?
What is dynamic in swift?
What is nsdictionary in swift?
What does appdelegate swift do?
Explain what is half-open range operator?
What are delegates swift 4?
What is the full meaning of swift?
How can you prioritize the usability of the demand process?
How is swift different from objective-c?
What are the different floating point numbers in swift?