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
How can you add table view?
Does apple use swift internally?
Is swift similar to c?
What is the difference between array and nsarray?
Does swift have abstract classes?
How to declare an empty dictionary in swift?
What is better swift or objective c?
What are the type of integers does swift have?
What is a string swift?
What is data type in swift?
What is indexpath in swift?
In swift what is use of backticks while declaring a variable?
What are floating point numbers? How many types of floating number are there?
Why swift is safe?
What is atomic swift?